List of utility methods to do BigDecimal Parse
boolean | isInteger(BigDecimal decimal) is Integer BigDecimal decimal_int = decimal.setScale(1, RoundingMode.DOWN); return decimal_int.compareTo(decimal) == 0 ? true : false; |
boolean | isInteger(BigDecimal inValue) is Integer try { inValue.intValueExact(); } catch (final Exception e) { return false; |
boolean | isIntegerBigDecimal(BigDecimal bd) Tells if a BigDecimal stores a whole number. return bd.scale() <= 0
|| bd.setScale(0, BigDecimal.ROUND_DOWN).compareTo(bd) == 0;
|
boolean | isIntegerValue(final BigDecimal bd) is Integer Value return bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0;
|
BigDecimal | parseBigDecimal(Object o, BigDecimal defaulti) parse Big Decimal try { return new BigDecimal(o.toString()); } catch (Exception e) { return defaulti; |
BigDecimal | parseBigDecimal(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; |
BigDecimal | parseBigDecimal(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) ... |
BigDecimal | parseBigDecimal(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; ... |
BigDecimal | parseBigDecimal(String data) parse Big Decimal if (data == null) { return null; try { return new BigDecimal(data); } catch (NumberFormatException e) { return null; |
BigDecimal | parseBigDecimal(String inString, BigDecimal inDefault) parse Big Decimal try { return new BigDecimal(inString); } catch (final Exception e) { return inDefault; |