Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerAbsExample { public static void main(String[] args){ BigInteger big1, big2, big3, big4; // create 4 BigInteger objects big1=new BigInteger("345");// assign value to big1 big2=new BigInteger("-345"); // assign value to big2 big3=big1.abs (); // assign absolute value of big1 to big 3 big4=big2.abs (); // assign absolute value of big 2 to big 4. String str1 = "Absolute value of" + big1 + "is" + big3; String str2 = "Absolute value of" + big2 + "is" + big4; // print big3, big4 values System.out.println(str1); System.out.println(str2 ); } }
Output