Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerGetLowestSetBitExample2{ public static void main(String[] args){ // create 2 BigInteger objects BigInteger big1= new BigInteger("0"); //0000 (no one's ) BigInteger big2= new BigInteger("15"); //1111 (no zero's) // get the index of lowestsetbit value of BigIntegers int index1= big1.getLowestSetBit(); int index2= big2.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; System.out.println(str1); System.out.println(str2); } }
Output