Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerSetBitExample3{ public static void main(String[] args){ // create 2 BigInteger object BigInteger big1,big2; // assign value to big1 big1= new BigInteger("5"); // 0101 // perform setbit operation on big1 // assume index n is 2 big2= big1.setBit(2); // 0101 String str = " SetBit operation on " + big1+ " at index 2 gives " + big2; System.out.println(str); } }
Output