Description Of BigInteger: andNot(BigInteger val)
The
java.math.BigInteger.andNot(BigInteger val) 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 negative BigInteger if and only if this is negative and val is positive
Code Example Java BigInteger
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("6"); // 110
BigInteger bi2 = new BigInteger("3"); // 011 ~010=101
System.out.println(bi1.andNot(bi2)); // 100
bi1 = new BigInteger("5"); // 0101
bi2 = new BigInteger("8"); // 1000 ~1000=0111
System.out.println(bi1.andNot(bi2)); // 0101
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น