Java Utililty Methods BigDecimal from

List of utility methods to do BigDecimal from

Description

The list of methods to do BigDecimal from are organized into topic(s).

Method

BigDecimaltoBigDecimal(Number number, int scale)
to Big Decimal
BigDecimal bd = toBigDecimal(number);
return rescaleBigDecimal(bd, scale);
BigDecimaltoBigDecimal(Number price)
to Big Decimal
BigDecimal decimal;
if (price instanceof BigDecimal)
    decimal = (BigDecimal) price;
else
    decimal = BigDecimal.valueOf(price.doubleValue());
return decimal;
BigDecimaltoBigDecimal(Object n)
to Big Decimal
if (n != null && (n instanceof Number)) {
    if (n instanceof Double)
        return BigDecimal.valueOf((Double) n);
    if (n instanceof Integer)
        return BigDecimal.valueOf((Integer) n);
    if (n instanceof Long)
        return BigDecimal.valueOf((Long) n);
    if (n instanceof Short)
...
BigDecimaltoBigDecimal(Object obj)
Convert number object to BigDecimal
if (obj instanceof Integer) {
    return BigDecimal.valueOf((int) obj);
} else if (obj instanceof Long) {
    return BigDecimal.valueOf((long) obj);
} else if (obj instanceof Short) {
    return BigDecimal.valueOf((short) obj);
} else if (obj instanceof Double) {
    return BigDecimal.valueOf((double) obj);
...
BigDecimaltoBigDecimal(Object obj)
to Big Decimal
if (isNull(obj)) {
    return getNull();
if (obj instanceof BigDecimal) {
    return (BigDecimal) obj;
if (obj instanceof Integer) {
    return new BigDecimal((Integer) obj);
...
BigDecimaltoBigDecimal(Object object)
to Big Decimal
if (object == null) {
    return new BigDecimal(0);
} else {
    return new BigDecimal(object.toString());
BigDecimaltoBigDecimal(Object val)
to Big Decimal
if (val == null) {
    return null;
if (val instanceof Float) {
    return new BigDecimal((Float) val);
if (val instanceof Double) {
    return new BigDecimal((Double) val);
...
BigDecimaltoBigDecimal(Object value)
Convert an Object to a BigDecimal.
if (value == null)
    return null;
if (value instanceof BigDecimal)
    return (BigDecimal) value;
if (value instanceof String) {
    if ("".equals((String) value))
        return null;
    return new BigDecimal((String) value);
...
BigDecimaltoBigDecimal(Object value)
to Big Decimal
return toBigDecimal(value, new BigDecimal(0));
BigDecimaltoBigDecimal(String _str)
to Big Decimal
BigDecimal bd = null;
if (_str != null) {
    try {
        bd = new BigDecimal(_str);
    } catch (Exception e) {
        return null;
return bd;