BigDecimal.valueOf(double val) has the following syntax.
public static BigDecimal valueOf(double val)
In the following code shows how to use BigDecimal.valueOf(double val) method.
/*w w w.java 2 s . c o m*/ import java.math.BigDecimal; public class Main { public static void main(String[] args) { Double d = new Double("123.45678"); BigDecimal bg = BigDecimal.valueOf(d); System.out.println( bg ); } }
The code above generates the following result.