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