Java BigDecimal.valueOf(double val)
Syntax
BigDecimal.valueOf(double val) has the following syntax.
public static BigDecimal valueOf(double val)
Example
In the following code shows how to use BigDecimal.valueOf(double val) method.
// w w w. ja va2 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.