long l = 1234567890L; BigInteger bigInteger = BigInteger.valueOf(l); System.out.println(bigInteger);
1234567890
long l = -9876543210L; BigInteger bigInteger = BigInteger.valueOf(l); System.out.println(bigInteger);
-9876543210In both examples, the valueOf() method is used to convert a long value to its corresponding BigInteger object. The first example converts a positive long value, while the second example converts a negative long value. Package library: java.math