Java BigInteger getLowestSetBit() methodThe getLowestSetBit() method of Java BigInteger class is used to get the position of the rightmost set bit of this BigInteger. This method returns an integer whose value is the total number of reset bits (0's) to the right of the rightmost set bit. This method computes (this == 0 ? -1 : log2(this & -this)). Syntax:Parameter:NA. Returns:This method returns the index of the rightmost set bit in this BigInteger. Exception:NA Note: This method returns -1 if this BigInteger contains no one bits.Example 1Test it NowOutput: Index of the rightmost set bit in 8 is 3 Index of the rightmost set bit in 1 is 0 Index of the rightmost set bit in 10 is 1 Example 2Test it NowOutput: Index of the rightmost set bit in 0 is -1 Index of the rightmost set bit in 15 is 0 Next TopicJava BigInteger |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India