Description Of BigInteger: testBit(int n)
The java.math.BigInteger.testBit(int n) returns true if and only if the designated bit is set. (Computes ((this & (1<<n)) != 0))BigInteger.testBit(int n) method returns true if and only if the designated bit is set
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi = new BigInteger("10");
Boolean b1 = bi.testBit(2);
Boolean b2 = bi.testBit(3);
// print b1, b2 values
System.out.println(b1);
System.out.println(b2);
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น