Java Utililty Methods BigDecimal Parse

List of utility methods to do BigDecimal Parse

Description

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

Method

booleanisInteger(BigDecimal decimal)
is Integer
BigDecimal decimal_int = decimal.setScale(1, RoundingMode.DOWN);
return decimal_int.compareTo(decimal) == 0 ? true : false;
booleanisInteger(BigDecimal inValue)
is Integer
try {
    inValue.intValueExact();
} catch (final Exception e) {
return false;
booleanisIntegerBigDecimal(BigDecimal bd)
Tells if a BigDecimal stores a whole number.
return bd.scale() <= 0 
        || bd.setScale(0, BigDecimal.ROUND_DOWN).compareTo(bd) == 0; 
booleanisIntegerValue(final BigDecimal bd)
is Integer Value
return bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0;
BigDecimalparseBigDecimal(Object o, BigDecimal defaulti)
parse Big Decimal
try {
    return new BigDecimal(o.toString());
} catch (Exception e) {
    return defaulti;
BigDecimalparseBigDecimal(Object obj)
parse Big Decimal
BigDecimal value = BigDecimal.ZERO;
if (obj != null) {
    try {
        value = new BigDecimal(obj.toString());
    } catch (Exception var3) {
        value = BigDecimal.ZERO;
return value;
BigDecimalparseBigDecimal(Object value)
parse Big Decimal
String str;
if (value == null)
    return BigDecimal.valueOf(0L);
if (value instanceof BigDecimal)
    return ((BigDecimal) value);
if (value instanceof Number)
    return BigDecimal.valueOf(((Number) value).longValue());
if (value instanceof Boolean)
...
BigDecimalparseBigDecimal(Object value)
parse Big Decimal
if (value == null || value.toString().isEmpty()) {
    return null;
} else {
    try {
        Double check = Double.parseDouble(value.toString());
        return new BigDecimal(check);
    } catch (NumberFormatException e) {
        return null;
...
BigDecimalparseBigDecimal(String data)
parse Big Decimal
if (data == null) {
    return null;
try {
    return new BigDecimal(data);
} catch (NumberFormatException e) {
    return null;
BigDecimalparseBigDecimal(String inString, BigDecimal inDefault)
parse Big Decimal
try {
    return new BigDecimal(inString);
} catch (final Exception e) {
    return inDefault;