In this post, we will see how to convert BigDecimal to BigInteger in java.
Using BigDecimal constructor
You can simply use BigDecimal's toBigInteger()
method to convert BigDecimal to BigInteger.
Please note that this method will simply remove fractional part and you will loss precision while converting from BigDecimal to BigInteger in java.
Here is the complete example to convert BigDecimal to BigInteger in java.
When you run above program, you will get below output:
BigDecimal bd: 10
That’s all about how to convert BigInteger to BigDecimal in java.
Was this post helpful?
Let us know if this post was helpful. Feedbacks are monitored on daily basis. Please do provide feedback as that\'s the only way to improve.