List of utility methods to do BigDecimal
BigDecimal | getWithoutTrailingZeroes(@Nullable final BigDecimal aValue) Get the passed BigDecimal without any trailing zeroes. if (aValue == null) return null; if (BigDecimal.ZERO.compareTo(aValue) == 0) return BigDecimal.ZERO; final BigDecimal ret = aValue.stripTrailingZeros(); return ret.scale() >= 0 ? ret : ret.setScale(0); |
int | hash(BigDecimal bd) hash if (bd == null) return NULL_HASH; return bd.hashCode(); |
boolean | hasSignedChanged(final BigDecimal v1, final BigDecimal v2) has Signed Changed return signum(v1) != signum(v2);
|
String | htmlFooter(String providerNo, int count, BigDecimal total) html Footer StringBuilder htmlFooter = new StringBuilder(); htmlFooter.append( "<tr><td colspan='11' class='bodytext'> </td> </tr> <tr> <td colspan='5' class='bodytext'>Billing No: "); htmlFooter.append(providerNo); htmlFooter.append(": "); htmlFooter.append(count); htmlFooter.append(" RECORDS PROCESSED</td> <td colspan='6' class='bodytext'>TOTAL: "); htmlFooter.append(total); ... |
String | humanReadableByteCount(BigDecimal bytes, Boolean si) human Readable Byte Count return humanReadableByteCount(bytes.doubleValue(), si);
|
BigDecimal | incRatio(BigDecimal o1, BigDecimal o2) calc a increase ratio between two BigDecimal; double d1, d2; if (o1 == null && o2 == null) { return new BigDecimal(0); if (o2 == null || o2.intValue() == 0) { return new BigDecimal(100); if (o1 != null) { ... |
BigDecimal | intToBigDecimal(int i) int To Big Decimal BigInteger bigint = BigInteger.valueOf(i); BigDecimal bigdec = new BigDecimal(bigint); return bigdec; |
int | intValue(BigDecimal a) int Value if (a == null) { return 0; return a.intValue(); |
BigDecimal | inverse(final BigDecimal amount) inverse return amount.equals(BigDecimal.ZERO) ? amount : BigDecimal.ONE.divide(amount, RoundingMode.HALF_EVEN);
|
BigDecimal | invert(BigDecimal d) Divide 1 by the specified BigDecimal. return divide(BigDecimal.ONE, d);
|