Here you can find the source of toBigDecimal(double val)
public static BigDecimal toBigDecimal(double val)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static BigDecimal toBigDecimal(double val) { assert !Double.isNaN(val); assert !Double.isInfinite(val); return new BigDecimal(Double.toString(val)); }/* ww w. ja v a2s . com*/ public static BigDecimal toBigDecimal(long val) { return new BigDecimal(val); } }