How we convert BigDecimal
into Double
in java? I have a requirement where we have to use Double as argument but we are getting BigDecimal
so i have to convert BigDecimal
into Double
.
This question is related to
java
Use doubleValue method present in BigDecimal class :
double doubleValue()
Converts this BigDecimal
to a double
.
You can convert BigDecimal
to double
using .doubleValue()
. But believe me, don't use it if you have currency manipulations. It should always be performed on BigDecimal
objects directly. Precision loss in these calculations are big time problems in currency related calculations.
Source: Stackoverflow.com