Java bigdecimal class doubleValue() method translates bigdecimal value in to double type value.
Java BigDecimal doubleValue example
Java bigdecimal class doubleValue() method translates bigdecimal value in to double type value. Method throws NumberFormatException if it finds a String bigdecimal value instead of a integer or double value. In the example four bigdecimal objects namely: algorithm_0, algorithm_1, algorithm_2 & algorithm_3 respectively have been created. Except the first object rest all objects are assigned positive decimal values with java.lang.Math class fields and methods.
In the example along with method generated result, original BigDecimal value is also shown
Syntax for using the method: public double doubleValue()
System.out.println(bigdecimal_objectName.doubleValue()));
Java_BigDecimal_doubleValue.java
import java.math.BigDecimal;
|