How to convert BigInteger to BigDecimal?

Regis picture Regis · Jun 25, 2010 · Viewed 41.3k times · Source

Is there any way to convert a BigInteger into a BigDecimal?

I know you can go from a BigDecimal to a BigInteger, but I can't find a method to go the other way around in Java.

Answer

bdhar picture bdhar · Jun 25, 2010

You have a parameterized constructor for that.

BigDecimal(BigInteger val)