Description Of BigInteger: and(BigInteger val)
The
java.math.BigInteger.and(BigInteger val) returns a BigInteger whose value is (this & val). This method returns a negative BigInteger if and only if this and val are both negative.
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("6"); // 110
BigInteger bi2 = new BigInteger("3"); // 011
System.out.println(bi1.and(bi2)); // 010
bi1 = new BigInteger("5"); // 0101
bi2 = new BigInteger("8"); // 1000
System.out.println(bi1.and(bi2)); // 0000
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น