Here you can find the source of tryParseBigDecimal(Object val, BigDecimal defaultVal)
public static BigDecimal tryParseBigDecimal(Object val, BigDecimal defaultVal)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { public static BigDecimal tryParseBigDecimal(Object val, BigDecimal defaultVal) { if (val == null) return defaultVal; if (val instanceof BigDecimal) return (BigDecimal) val; try {/*from w w w .j a va2s . co m*/ return new BigDecimal(String.valueOf(val)); } catch (Exception e) { return defaultVal; } } }