cn.ipokerface.common.utils.NumberUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Common Library of ipokerface
package cn.ipokerface.common.utils;
/**
* Created by PokerFace
* Create Date 2019-10-28.
* Email:
* Version 1.0.0
*
* Description:
*/
public class NumberUtils {
/**
* ture if number is not null and is not zero
*
* @param number value
* @return value is not null
*/
public static boolean notZero(Number number){
return number != null && number.intValue() != 0;
}
/**
* true if number is null or zero
*
* @param number value
* @return value is null
*/
public static boolean isZero(Number number) {
return !notZero(number);
}
/**
* transfer null to zero if number is null or is zero
*
* @param number value
* @return value or 0
*/
public static int zeroIfNull(Integer number){
return number == null? 0: number;
}
/**
* transfer null to zero if number is null or is zero
*
* @param number value
* @return value or 0
*/
public static long zeroIfNull(Long number){
return number == null? 0: number;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy