Java BigInteger negate() Method

The negate() method of Java BigInteger class returns a new BigInteger that is identical to this BigInteger except that its sign is reversed.

Syntax:

Returns:

This method returns a BigInteger whose value is (-this).

Parameter:

NA

Exception:

NA

Example 1

Test it Now

Output:

Negated value of 1000 is -1000

Example 2

Test it Now

Output:

Negated value of -123 is 123

Next TopicJava BigInteger




Latest Courses