List of utility methods to do BigDecimal Create
BigDecimal | bigDecimal(Number num) big Decimal if (num == null) throw new NullPointerException(); if (num instanceof BigDecimal) return (BigDecimal) num; if (num instanceof BigInteger) return new BigDecimal((BigInteger) num); if (num instanceof Byte) return new BigDecimal((Byte) num); ... |
BigDecimal | bigDecimal(Object object) big Decimal if (object == null) { throw new NullPointerException(); BigDecimal result; try { result = new BigDecimal(String.valueOf(object).replaceAll(",", "")); } catch (NumberFormatException e) { throw new NumberFormatException("Please give me a numeral.Not " + object); ... |
BigDecimal | bigDecimalFromBytes(byte[] decimalBytes, int scale) Returns a BigDecimal from the given bytes and scale. final BigInteger bigInt = new BigInteger(decimalBytes); return new BigDecimal(bigInt, scale); |
java.math.BigDecimal | bigDecimalFromString(String s) big Decimal From String int len = s.length(); byte[] data = s.getBytes(); int i; int tickPos = -1; boolean finishedWithDigits = false; for (i = 0; i < len; i++) { byte b = data[i]; if ((b == 0 || b == 32) && !finishedWithDigits) { ... |
BigDecimal | bigDecimalValue(final Number number) big Decimal Value if (number == null) return null; if (number instanceof BigDecimal) return (BigDecimal) number; if (number instanceof BigInteger) return new BigDecimal((BigInteger) number); return (number instanceof Double || number instanceof Float) ? BigDecimal.valueOf(number.doubleValue()) : BigDecimal.valueOf(number.longValue()); ... |
BigDecimal | bigDecimalValueOf(Number n) Converts a number into its BigDecimal equivalent. if (n instanceof BigDecimal) { return (BigDecimal) n; } else if (n instanceof BigInteger) { return new BigDecimal((BigInteger) n); } else if (n instanceof Double) { return new BigDecimal((Double) n); } else if (n instanceof Float) { return new BigDecimal((Float) n); ... |
BigDecimal | createBigDecimal(double v) create Big Decimal return new BigDecimal(Double.toString(v)); |
BigDecimal | createBigDecimal(final String value) This method creates a new big-decimal. return createBigDecimal(new BigDecimal(value)); |
BigDecimal | createBigDecimal(Object value) create Big Decimal BigDecimal valueAsBd = null; if (value instanceof Number) { valueAsBd = new BigDecimal(((Number) value).doubleValue()); } else { if (value instanceof String) { valueAsBd = new BigDecimal((String) value); } else { valueAsBd = new BigDecimal(value.toString()); ... |
BigDecimal | createBigDecimal(String val) Convert a BigDecimal bd = new BigDecimal(val); return bd; |