1.

BigInteger negate value

Answer»

Use the BigInteger negate() METHOD to nagate a BigInteger VALUE in Java.

Let us see a simple example:

import java.math.*; PUBLIC CLASS Example {   public static void main(String[] args) {      BigInteger b1, b2;      b1 = new BigInteger("35");      b2 = b1.negate();      System.out.println("Negated = " +b2);   } }

The output:

Negated = -35


Discussion

No Comment Found