Here you can find the source of bigDecimal(Number num)
public static BigDecimal bigDecimal(Number num)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.math.BigInteger; public class Main { public static BigDecimal bigDecimal(Number num) { if (num == null) throw new NullPointerException(); if (num instanceof BigDecimal) return (BigDecimal) num; if (num instanceof BigInteger) return new BigDecimal((BigInteger) num); if (num instanceof Byte) return new BigDecimal((Byte) num); if (num instanceof Double) return new BigDecimal((Double) num); if (num instanceof Float) return new BigDecimal((Float) num); if (num instanceof Integer) return new BigDecimal((Integer) num); if (num instanceof Long) return new BigDecimal((Long) num); if (num instanceof Short) return new BigDecimal((Short) num); String message = String.format("Unsupported number object %s(%s) is given.", num, num.getClass()); throw new IllegalArgumentException(message); }/* ww w . j av a 2 s. c o m*/ }