Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerTestBitExample2{ public static void main(String[] args){ // create a BigInteger object BigInteger big1; // create a Boolean object Boolean bool; // assign value to big1 big1= new BigInteger("5"); // perform testBit on big1 at index // assume n is -2 bool= big1.testBit(-2); String str = " Test Bit on " + big1+" at index -2 returns "+bool; System.out.println(str); } }
Output