Java BigInteger andNot() Method

The andNot() method of Java BigInteger classreturns the bitwise AND of this BigInteger and the bitwise negation of the given BigInteger as a new BigInteger. Calling this method is equivalent to calling and (val.not()).

Syntax:

Parameter:

val - Value to be complemented and AND'ed with this BigInteger.

Returns:

This method returns a BigInteger object of value, this & ~val.

Note:This method returns a negative BigInteger if and only if this is negative and val is positive.

Example 1

Test it Now

Output:

Result of andNot operation is 3

Example 2

Test it Now

Output:

Result of andNot operation is -7

Next TopicJava BigInteger




Latest Courses