Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerNegateExample2{ public static void main(String[] args){ // create 2 BigInteger objects BigInteger big1,big2; big1= new BigInteger("-123"); // assign negate value of big1 to big2 big2= big1.negate(); String str="Negated value of "+ big1+" is "+big2; System.out.println(str); } }
Output