andNot(): This method is available in java.math.BigInteger class of Java.
Syntax:
BigInteger java.math.BigInteger.andNot(BigInteger val)
This method takes one argument of type BigInteger as its parameter. It returns a BigInteger whose value is (this & ~val). This method, which is equivalent to and(val.not()), is provided as a convenience for masking operations. (This method returns a negativeBigInteger if and only if this is negative and val is positive.)
Parameters: One parameter is required for this method.
val: value to be complemented and AND'ed with this BigInteger.
Returns: this & ~val
For Example:
BigInteger bigInteger = new BigInteger("1234")
BigInteger val = new BigInteger("1235")
bigInteger.andNot(val) = > It returns 0.
Approach
Java
import java.math.BigInteger;public class BigIntegerandNot {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("1234");BigInteger val = new BigInteger("1235");System.out.println(bigInteger.andNot(val));}}
Output:
0
No comments:
Post a Comment