Java BigInteger.getLowestSetBit()
Syntax
BigInteger.getLowestSetBit() has the following syntax.
public int getLowestSetBit()
Example
In the following code shows how to use BigInteger.getLowestSetBit() method.
import java.math.BigInteger;
/*from w w w .j a v a 2s . co m*/
public class Main {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("8");// 1000
BigInteger bi2 = new BigInteger("7");// 0111
// perform getLowestSetBit on bi1, bi2
int i1 = bi1.getLowestSetBit();
int i2 = bi2.getLowestSetBit();
System.out.println(i1);
System.out.println(i2);
}
}
The code above generates the following result.