Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerIntValueExample { public static void main(String[] args){ // create 4 BigIntegerobjects BigInteger big1,big2,big3,big4; // create 4Integerobjects int int1,int2,int3,int4; // assign values to big1,big2,big3,big4 big1= new BigInteger("123"); big2= new BigInteger("-123"); big3= new BigInteger("12345678901"); big4= new BigInteger("-12345678901"); // assign intvalue of big1,big2,big3,big4 to int1,int2,int3, int4 int1= big1.intValue(); int2= big2.intValue(); int3= big3.intValue(); int4= big4.intValue(); String str1= "Result of intValueoperation on " +big1+" is " + int1; String str2= "Result of intValueoperation on " +big2+"is" + int2; String str3= "Result of intValueoperation on " + big3 +" is " + int3; String str4= "Result of intValueoperation on " + big4 +" is " + int4; // print int1,int2,int3,int4 values System.out.println(str1); System.out.println(str2); System.out.println(str3); System.out.println(str4); } }
Output