Here you can find the source of getBigDecimal(Object value)
public static BigDecimal getBigDecimal(Object value) throws Exception
//package com.java2s; //License from project: Open Source License import java.math.*; public class Main { public static BigDecimal getBigDecimal(Object value) throws Exception { // check for NULL if (value == null) { return null; }//from w ww . jav a 2 s . com try { return (new BigDecimal(value.toString().trim())); } catch (NumberFormatException ex) { throw new Exception("bigdecimal conversion failed. (" + value.toString().trim() + ")"); } } public static BigDecimal getBigDecimal(Object value, int scale) throws Exception { BigDecimal bDecimal, result; // check for NULL if (value == null) { return (new BigDecimal(0)); } bDecimal = getBigDecimal(value); result = bDecimal.setScale(scale); return result; } }