Here you can find the source of convertToDecimal(Number n)
private static BigDecimal convertToDecimal(Number n)
//package com.java2s; // Clark & Parsia, LLC parts of this source code are available under the terms of the Affero General Public License v3. import java.math.BigDecimal; public class Main { private static BigDecimal convertToDecimal(Number n) { if (n instanceof BigDecimal) return (BigDecimal) n; else// w ww . j ava 2 s . c o m return new BigDecimal(n.toString()); } }