List of utility methods to do BigDecimal to
BigDecimal | convertSecondsToMillis(BigDecimal seconds) Number of second = # of seconds * 1000 millis return seconds.multiply(new BigDecimal(1000)); |
BigDecimal | convertStringToBigDecimal(String strValue) convert String To Big Decimal BigDecimal bgValue = new BigDecimal(strValue); return bgValue; |
BigDecimal | convertToBigDecimal(final Object o) convert To Big Decimal if (o instanceof Number) { return convertToBigDecimal((Number) o); return null; |
BigDecimal | convertToBigDecimal(Object sourceValue) convert To Big Decimal if (sourceValue instanceof Number) { return new BigDecimal(((Number) sourceValue).toString()); } else if (sourceValue instanceof String) { return new BigDecimal((String) sourceValue); return null; |
BigDecimal | convertToBigDecimal(String s) convert To Big Decimal if ((s == null) || s.equals("")) { return null; if (s.startsWith("+")) { s = s.substring(1); return new BigDecimal(s); |
BigDecimal | convertToBigDecimal(String val) convert To Big Decimal BigDecimal returnValue = new BigDecimal(0.00); if (val == null || val.trim().equals("")) { return returnValue; val = val.replace(",", ""); val = val.replace("$", ""); returnValue = new BigDecimal(val.trim()); return returnValue; ... |
BigDecimal | convertToBigDecimal(String value) convert To Big Decimal if (value == null || value.trim().isEmpty()) { return null; try { return new BigDecimal(value.trim()); } catch (RuntimeException e) { throw new Exception("convertToBigDecimal:" + value + " failed:" + e.getMessage(), e); |
BigDecimal | convertToBigDecimal(String value) Convert a string representing a decimal value into a BigDecimal object BigDecimal result = null; if (isValid(value)) { result = new BigDecimal(value.trim()); return result; |
Long | convertToFen(BigDecimal num1) convert To Fen if (null == num1) { return ZERO.longValue(); BigDecimal temp = multiply(num1, HUNDRED); return temp.longValue(); |
int | decimalToBytes(BigDecimal v, byte[] result, final int offset, int length) decimal To Bytes int signum = v.signum(); if (signum == 0) { result[offset] = ZERO_BYTE; return 1; int index = offset + length; int scale = v.scale(); int expOffset = scale % 2 * (scale < 0 ? -1 : 1); ... |