NumberUtil.java 537 B

123456789101112131415161718192021
  1. package com.ruoyi.common.utils;
  2. public class NumberUtil {
  3. /**
  4. * 安全获取Integer值,null时返回0
  5. * @param number Integer对象
  6. * @return int值,null时返回0
  7. */
  8. public static int getIntValue(Integer number) {
  9. return number != null ? number : 0;
  10. }
  11. /**
  12. * 安全获取Long值,null时返回0L
  13. * @param number Long对象
  14. * @return long值,null时返回0L
  15. */
  16. public static long getLongValue(Long number) {
  17. return number != null ? number : 0L;
  18. }
  19. }