How to convert BigDecimal to Double in Java?

后端 未结 3 623
无人及你
无人及你 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:23

    You need to use the doubleValue() method to get the double value from a BigDecimal object.

    BigDecimal bd; // the value you get
    double d = bd.doubleValue(); // The double you want
    

提交回复
热议问题