List of utility methods to do BigDecimal
BigDecimal | strValueBigDecimal(Number number) str Value Big Decimal if (number == null) { return zeroBigDecimal(); return new BigDecimal(String.valueOf(number)); |
BigDecimal | tangent(BigDecimal x) tangent BigDecimal sin = sine(x);
BigDecimal cos = cosine(x);
return sin.divide(cos, SCALE, BigDecimal.ROUND_HALF_UP);
|
BigDecimal | tanto(BigDecimal r, BigDecimal n) tanto return r.divide(n);
|
BigDecimal | textToBigDecimal(String amountAsText) text To Big Decimal return new BigDecimal(amountAsText).setScale(DECIMAL_SCALE, ROUNDING_MODE); |
int | transferDonateAmount2Point(BigDecimal donateAmount) transfer Donate Amount Point if (donateAmount == null) { return 0; Double temp = donateAmount.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); return temp.intValue() / TEN_YUAN; |
BigDecimal | tryParseBigDecimal(Object val, BigDecimal defaultVal) try Parse Big Decimal if (val == null) return defaultVal; if (val instanceof BigDecimal) return (BigDecimal) val; try { return new BigDecimal(String.valueOf(val)); } catch (Exception e) { return defaultVal; ... |
BigDecimal | tryToStoreAsIntegerBigDecimal(Object ob) try To Store As Integer Big Decimal BigDecimal bigDecimal = null; if (canBeStoredAsIntegerBigDecimal(ob)) { bigDecimal = new BigDecimal(ob.toString()); return bigDecimal; |
BigDecimal | tryToStoreAsRealBigDecimal(Object ob) try To Store As Real Big Decimal BigDecimal bigDecimal = null; if (canBeStoredAsRealBigDecimal(ob)) { bigDecimal = new BigDecimal(ob.toString()); } else if (ob instanceof BigDecimal) { bigDecimal = (BigDecimal) ob; return bigDecimal; |
String | unformattedFromBigDecimal(BigDecimal n) Convert a BigDecimal to the unformatted form. if (n == null) { return ""; return n.toPlainString(); |
BigDecimal | unformattedToBigDecimal(String str) Convert an unformatted string to BigDecimal .
if (str == null || str.length() == 0) { str = "0"; BigDecimal b = new BigDecimal(str); return b.setScale(b.scale(), BigDecimal.ROUND_HALF_UP); |