Here you can find the source of numberToBigDecimal(Number value)
public static BigDecimal numberToBigDecimal(Number value)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static BigDecimal numberToBigDecimal(Number value) { if (isAFloatingPointNumber(value)) { return new BigDecimal(value.doubleValue()); } else {/*from w w w.j av a 2 s . c om*/ return new BigDecimal(value.longValue()); } } public static boolean isAFloatingPointNumber(Number value) { return value instanceof Double || value instanceof Float; } }