import java.math.BigInteger; public class Example { public static void main(String[] args) { BigInteger a = new BigInteger("-123"); BigInteger b = a.abs(); System.out.println(b); // prints 123 } }
import java.math.BigInteger; public class Example { public static void main(String[] args) { BigInteger a = new BigInteger("456"); BigInteger b = BigInteger.valueOf(-789); BigInteger c = a.add(b); BigInteger d = c.abs(); System.out.println(d); // prints 333 } }In this example, we create two BigInteger objects `a` and `b`, initialized to 456 and -789 respectively. We then compute the sum of `a` and `b` using the `add()` method, and assign the result to a new BigInteger `c`. We then call the `abs()` method on `c`, which returns a new BigInteger `d` with the absolute value of `c`. We then print the value of `d`. The package library for `java.math.BigInteger` is the built-in Java Math library.