Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerGetLowestSetBitExample1{ public static void main(String[] args){ // create 3 BigInteger objects BigInteger big1= new BigInteger("8"); //1000 BigInteger big2= new BigInteger("1"); //0001 BigInteger big3= new BigInteger("10"); //1010 // get the index of lowestsetbit value of BigIntegers int index1= big1.getLowestSetBit(); int index2= big2.getLowestSetBit(); int index3= big3.getLowestSetBit(); String str1=" Index of the rightmost set bit in "+big1+" is "+ index1; String str2=" Index of the rightmost set bit in "+big2+" is "+ index2; String str3=" Index of the rightmost set bit in "+big3+" is "+ index3; System.out.println(str1); System.out.println(str2); System.out.println(str3); } }
Output