Online Java Compiler By
JavaTpoint.com
import java.math.BigDecimal; public class BigDecimalIntValueExactExample4 { public static void main(String[] args) { // Creating BigDecimal Objects BigDecimal bdValue; //Create int variable int integerValue; // Assigning value into BigDecimal object bdValue = new BigDecimal("74346789105829485"); //it returns integer value integerValue=bdValue.intValueExact(); // Displaying exact Integer Value System.out.println("Returned Exact Integer Value of " +bdValue + " is = " + integerValue); } }
Output