How to convert BigDecimal to Double in Java?

后端 未结 3 617
无人及你
无人及你 2021-01-30 03:48

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

3条回答
  •  日久生厌
    2021-01-30 04:24

    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.

提交回复
热议问题