Convert scala.math.BigDecimal to java.math.BigDecimal?

前端 未结 1 881
粉色の甜心
粉色の甜心 2021-02-07 01:25

How do I convert a scala.math.BigDecimal to java.math.BigDecimal?

1条回答
  •  囚心锁ツ
    2021-02-07 01:42

    No need to double-convert to and from string.

    val sb = scala.math.BigDecimal(12345)
    val jb = sb.bigDecimal
    

    scala.math.BigDecimal is just a very simple wrapper around java.math.BigDecimal, and it provides wrapped value as one of fields.

    0 讨论(0)
提交回复
热议问题