List of utility methods to do BigDecimal Create
BigDecimal | getBigDecimal(Object v, BigDecimal defaultValue) get Big Decimal if (v == null || VALUE_BLANK.equals(v)) { return null; } else if (v instanceof BigDecimal) { return (BigDecimal) v; } else if (v instanceof String) { return new BigDecimal((String) v); } else if (v instanceof Integer) { return new BigDecimal((Integer) v); ... |
BigDecimal | getBigDecimal(Object value) get Big Decimal if (value == null) { return null; try { return (new BigDecimal(value.toString().trim())); } catch (NumberFormatException ex) { throw new Exception("bigdecimal conversion failed. (" + value.toString().trim() + ")"); |
BigDecimal | getBigDecimal(Object value) get Big Decimal BigDecimal ret = null; if (value != null) { if (value instanceof BigDecimal) { ret = (BigDecimal) value; } else if (value instanceof String) { ret = new BigDecimal((String) value); } else if (value instanceof BigInteger) { ret = new BigDecimal((BigInteger) value); ... |
BigDecimal | getBigDecimal(String aInput) get Big Decimal return getBigDecimal(aInput, BLANK_DECIMAL);
|
BigDecimal | getBigDecimal(String value) get Big Decimal BigDecimal result = null; if (value != null) { try { result = BigDecimal.valueOf(Double.valueOf(value)); } catch (Exception ignored) { return result; ... |
BigDecimal[] | getBigDecimalArrayFromByteArray(byte[] buf) Convert a byte[] into an instance of our value class. BigDecimal[] a = new BigDecimal[buf.length / TOTAL_BYTES]; int index = 0; for (int i = 0; i < a.length; i++) { byte[] signal = new byte[NR_SIGNAL_BYTES]; System.arraycopy(buf, index, signal, 0, NR_SIGNAL_BYTES); index += NR_SIGNAL_BYTES; byte[] b = new byte[NR_BIGINTEGER_BYTES]; System.arraycopy(buf, index, b, 0, NR_BIGINTEGER_BYTES); ... |
BigDecimal | getBigDecimalByObject(Object obj) Gets the big decimal by object. if (obj == null) { return BigDecimal.valueOf(0.0); } else { BigDecimal result = null; try { result = new BigDecimal(String.valueOf(obj)); } catch (Exception ex) { result = BigDecimal.valueOf(0.0); ... |
BigDecimal | getBigDecimalFrom(double value) get Big Decimal From return new BigDecimal(String.valueOf(value)); |
BigDecimal | getBigDecimalFromByteArray(byte[] bytes, int start, int length, int scale) get Big Decimal From Byte Array byte[] value = Arrays.copyOfRange(bytes, start, start + length); BigInteger unscaledValue = new BigInteger(value); return new BigDecimal(unscaledValue, scale); |
BigDecimal | getBigDecimalFromPrimitiveTypes(int input, int scale, int precision) get Big Decimal From Primitive Types return BigDecimal.valueOf(input, scale);
|