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

booleanisJavaMathBigDecimal(Object value)
Checks if specified object is instance of java.math.BigDecimal.
return value instanceof java.math.BigDecimal;
booleanisLessOrEqualThanZero(BigDecimal value)
is Less Or Equal Than Zero
return value.compareTo(BigDecimal.ZERO) <= 0;
booleanisLessThan(final BigDecimal thiss, final BigDecimal that)
is Less Than
return thiss.compareTo(that) < 0;
booleanisLessThen(BigDecimal value1, BigDecimal value2)
is Less Then
int compareTo = value1.compareTo(value2);
return compareTo < 0;
booleanisLong(BigDecimal inValue)
is Long
try {
    inValue.longValueExact();
} catch (final Exception e) {
return false;
booleanisLongNumber(BigDecimal minCar)
is Long Number
try {
    Long.parseLong(minCar.toString());
    return true;
} catch (Exception ex) {
    return false;
booleanisLowerThanOne(@Nonnull final BigDecimal aValue)
is Lower Than One
return aValue.compareTo(BigDecimal.ONE) < 0;
booleanisMaximumDecimalValue(BigDecimal maxValue)
Checks if the specified BigDecimal value is a maximum value of a DECIMAL(x,0) data type.
This method will not consider a value smaller than the BIGINT data type maximum value as a potential DECIMAL maximum value.
if (maxValue != null && maxValue.compareTo(DATATYPE_BIGINT_MAX_VALUE) > 0) {
    Pattern p = Pattern.compile("[^9]+"); 
    Matcher m = p.matcher(maxValue.toString());
    return !m.find();
return false;
booleanisMoreThanZero(BigDecimal decimal)
is More Than Zero
if (decimal != null) {
    return decimal.compareTo(BigDecimal.ZERO) > 0;
return false;
BooleanisNegative(BigDecimal amount)
is Negative
return null != amount && BigDecimal.ZERO.compareTo(amount) == 1;