Java Utililty Methods BigDecimal Compare

List of utility methods to do BigDecimal Compare

Description

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

Method

intcompareToZeroOrNull(BigDecimal value)
compare To Zero Or Null
if (value == null)
    return 0;
else
    return compareToZero(value);
booleangreaterThan(BigDecimal decimal, double number)
greater Than
return greaterThan(decimal, new BigDecimal(number));
booleanGreaterThan(BigDecimal one, BigDecimal two)
Returns true if one > two
return (one.compareTo(two) > 0);
booleangreaterThan(BigDecimal val, double threshold)
greater Than
requireNonNull(val);
return val.compareTo(BigDecimal.valueOf(threshold)) > 0;
booleanGreaterThanOrEqual(BigDecimal one, BigDecimal two)
Greater Than Or Equal
if (!Equals(one, two)) {
    return GreaterThan(one, two);
return true;
BooleangreaterThanZero(BigDecimal d)
greater Than Zero
return d.compareTo(BigDecimal.ZERO) > 0;
booleangreaterThanZero(BigDecimal is)
greater Than Zero
return is != null && is.compareTo(BigDecimal.ZERO) > 0;
booleanisGreater(BigDecimal a, BigDecimal b)
is Greater
return a.compareTo(b) > 0;
booleanisGreaterThanOne(@Nonnull final BigDecimal aValue)
is Greater Than One
return aValue.compareTo(BigDecimal.ONE) > 0;
booleanlessThan(BigDecimal val1, BigDecimal val2)
less Than
int compareValue = val1.compareTo(val2);
return (compareValue < 0);