Java bigdecimal class intValueExact() method transforms
bigdecimal value exactly in to integer type values.
Method throws NumberFormatException if it value other than a integer or double.
And also throws an ArithmeticException when rounding is necessary.
In the example four bigdecimal objects namely: ganymede_0, ganymede_1, ganymede_2 & ganymede_3 respectively have been created.
In the example MathContext class object mc is created for rounding the objects value.
In the example along with method generated result, original BigDecimal value is also shown.
Syntax for using the method: public int intValueExact()
int i = (this.object).intValueExact();
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.