Is there any way to convert a BigInteger into a BigDecimal? i know you can go from DEC to INT but i cant find a method to go the other way around in JAVA.
thanks in advance.
Is there any way to convert a BigInteger into a BigDecimal? i know you can go from DEC to INT but i cant find a method to go the other way around in JAVA.
thanks in advance.
You have a parameterized constructor for that.
BigDecimal(BigInteger val)
There is a constructor for that.
BigDecimal bigdec = new BigDecimal(bigint);
BigDecimal public BigDecimal(BigInteger unscaledVal, int scale)Translates a BigInteger unscaled value and an int scale into a BigDecimal. The value of the BigDecimal is (unscaledVal/10scale).
Parameters: unscaledVal - unscaled value of the BigDecimal. scale - scale of the BigDecimal. Throws: NumberFormatException - scale is negative
Good luck!!!