83
Java BigDecimal doubleValue() method
The doubleValue() method of Java BigDecimal class is used to convert the BigDecimal value into a double type. If BigDecimal has very big value represented as a double, it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate. While conversion, we can lose information about the precision of the BigDecimal value.
Syntax:
Parameter:
No
Exception:
No
Returns:
It returns double value converted from BigDecimal.
Example 1
Output:
BigDecimal 123 value converted into double is =123.0
Example 2
Output:
BigDecimal 113367 value converted in to double is =113367.0
Example 3
Output:
BigDecimal -1120 value converted in to double is = -1120.0
Next TopicJava BigDecimal