Here you can find the source of toBigDecimal(Object n)
static final private BigDecimal toBigDecimal(Object n)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { static final private BigDecimal toBigDecimal(Object n) { if (n != null && (n instanceof Number)) { if (n instanceof Double) return BigDecimal.valueOf((Double) n); if (n instanceof Integer) return BigDecimal.valueOf((Integer) n); if (n instanceof Long) return BigDecimal.valueOf((Long) n); if (n instanceof Short) return BigDecimal.valueOf((Short) n); }// ww w . j a v a 2s . c om return null; } }