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;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java BigDecimal doubleValue example View All Comments
Post your Comment