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

Phil picture Phil · Mar 18, 2014 · Viewed 7.6k times · Source

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

Answer

Vladimir Matveev picture Vladimir Matveev · Mar 18, 2014

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.