Here you can find the source of toBigDecimal(Object object)
public static BigDecimal toBigDecimal(Object object)
//package com.java2s; import java.math.BigDecimal; public class Main { public static BigDecimal toBigDecimal(Object object) { if (object == null) { return new BigDecimal(0); } else {/* w w w . j a v a2 s . c o m*/ return new BigDecimal(object.toString()); } } public static String toString(BigDecimal num) { if (num == null) { return "0"; } else { return num.setScale(2).toString(); } } }