Here you can find the source of toBigDecimal(Number number)
Parameter | Description |
---|---|
number | original number |
public static BigDecimal toBigDecimal(Number number)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { /**/*from w w w . j a v a2 s . co m*/ * Converts (almost) any number to {@linkplain BigDecimal}. * * @param number * original number * @return same number but of {@linkplain BigDecimal} type */ public static BigDecimal toBigDecimal(Number number) { if (number instanceof BigDecimal) return (BigDecimal) number; return new BigDecimal(number.toString()); } }