Java Utililty Methods BigDecimal Value Check

List of utility methods to do BigDecimal Value Check

Description

The list of methods to do BigDecimal Value Check are organized into topic(s).

Method

booleanisAbsBetweenZeroAndOne(BigDecimal newValue)
is Abs Between Zero And One
BigDecimal newValueAbs = newValue.abs();
if (newValueAbs.compareTo(BigDecimal.ZERO) >= 0) {
    if (newValueAbs.compareTo(BigDecimal.ONE) <= 0) {
        return true;
return false;
booleanisAllBlank(BigDecimal[] values)
is All Blank
boolean and = true;
for (BigDecimal value : values) {
    and = and && isBlank(value);
return and;
booleanisBetweenAAndB(final BigDecimal target, final BigDecimal a, final BigDecimal b)
is Between A And B
return !(target.compareTo(a) < 0 || target.compareTo(b) > 0);
booleanisBlank(BigDecimal value)
is Blank
return (value == null || value.signum() == 0);
booleanisDivisible(BigDecimal num1, BigDecimal num2)
is Divisible
BigDecimal result = remainder(num1, num2);
return result.compareTo(BigDecimal.ZERO) == 0 ? true : false;
booleanisDouble(BigDecimal number)
is Double
double doubleValue = number.doubleValue();
return (doubleValue != Double.NEGATIVE_INFINITY) && (doubleValue != Double.POSITIVE_INFINITY);
booleanisDoubleOverFlow(final BigDecimal decimal)
is Double Over Flow
if (decimal.signum() == 0) {
    return false;
BigDecimal newDecimal = decimal;
boolean isPositive = decimal.signum() == 1;
if (!isPositive) {
    newDecimal = decimal.negate();
return (newDecimal.compareTo(MIN_DOUBLE_POSITIVE) < 0 || newDecimal.compareTo(MAX_DOUBLE_POSITIVE) > 0);
booleanisExact(final BigDecimal bd)
is Exact
return bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0;
booleanisFirstBiggerThanSecond(final BigDecimal first, final BigDecimal second)
is First Bigger Than Second
if (first == null && second == null) {
    return false;
} else if (second == null) {
    return true;
} else if (first == null) {
    return false;
return first.compareTo(second) > 0;
...
booleanisFirstEqualToSecond(final BigDecimal first, final BigDecimal second)
is First Equal To Second
if (first == null && second == null) {
    return false;
} else if (second == null) {
    return false;
} else if (first == null) {
    return false;
return first.compareTo(second) == 0;
...