Here you can find the source of castToBigDecimal(Object value)
public static BigDecimal castToBigDecimal(Object value)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.BigInteger; public class Main { public static BigDecimal castToBigDecimal(Object value) { if (value == null) { return null; }//ww w. j a v a2s . c om if (value instanceof BigDecimal) { return (BigDecimal) value; } if (value instanceof BigInteger) { return new BigDecimal((BigInteger) value); } String strVal = value.toString(); if (strVal.length() == 0) { return null; } return new BigDecimal(strVal); } }