Java bigdecimal class intValue() method transforms bigdecimal value in to integer type values.
Java BigDecimal intValue example
Java bigdecimal class intValue() method transforms bigdecimal
value in to integer type values.
Method throws NumberFormatException if it finds value other than a integer or double.
In the example four bigdecimal
objects namely: obj_0, obj_1, obj_2 & obj_3 respectively have been created. Except the first object rest all objects are assigned positive decimal values with java.lang.Math class fields and methods.
In the example along with method generated result, original bigdecimal
value is also shown.
Syntax for using the method: public int intValue()
System.out.println(bigdecimal_objectName.intValue());
or
int i = (this.object).intValue();
Java_BigDecimal_intValue.java
import java.math.BigDecimal;
|