BigInteger getLowestSetBit() Method in Java Last Updated : 04 Dec, 2018 Summarize Suggest changes Share Like Article Like Report prerequisite : BigInteger Basics The java.math.BigInteger.getLowestSetBit() method returns the index of the rightmost (lowest-order) set bit of this BigInteger. It means this method returns the number of zero or unset bits to the right of the rightmost set bit. If the BigInteger contains no set bit then this method will return -1. The method computes (thisBigInteger==0? -1 : log2(thisBigInteger & -thisBigInteger)). Syntax: public int getLowestSetBit() Parameters: The method does not accept any parameters. Return Value: The method returns the index of the rightmost set bit in this BigInteger. Examples: Input: value = 2300 Output: 2 Explanation: Binary Representation of 2300 = 100011111100 The lowest set bit index is 2 Input: value = 35000 Output: 3 Below program illustrate the getLowestSetBit() method of BigInteger: Java // Program to illustrate the getLowestSetBit() // method of BigInteger import java.math.*; public class GFG { public static void main(String[] args) { // Create BigInteger object BigInteger biginteger = new BigInteger("2300"); // Call getLowestSetBit() method on bigInteger // Store the return value as Integer lowestsetbit int lowestSetbit = biginteger.getLowestSetBit(); String lsb = "After applying getLowestSetBit on " + biginteger + " we get index of lowest set bit = " + lowestSetbit; // Printing result System.out.println(lsb); } } Output: After applying getLowestSetBit on 2300 we get index of lowest set bit = 2 Reference: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#getLowestSetBit() Advertise with us Next Article BigInteger bitLength() Method in Java A AmanSingh2210 Follow Similar Reads BigInteger clearBit() Method in Java Prerequisite: BigInteger BasicsThe clearBit() method returns a BigInteger which is used to clear a particular bit position in a BigInteger. The bit at index n of binary representation of BigInteger will be cleared means converted to zero. Mathematically we can say that it is used to calculate this 2 min read BigInteger flipBit() Method in Java Prerequisite: BigInteger Basics The java.math.BigInteger.flipBit(index) method returns a BigInteger which is used to flip a particular bit position in a BigInteger. This method Computes (bigInteger ^ (1<<n)). The bit at index n of binary representation of the bigInteger will be flipped. That i 2 min read BigInteger bitLength() Method in Java The java.math.BigInteger.bitLength() method returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. The bitLength method Computes (cei 1 min read BigInteger bitCount() Method in Java Prerequisite: BigInteger Basics The java.math.BigInteger.bitCount() method returns number of bits in the two's complement representation of this BigInteger that differ from its sign bit. This method is useful when implementing bit-vector style sets atop BigIntegers.Syntax: public int bitCount() Para 1 min read BigInteger intValue() Method in Java The java.math.BigInteger.intValue() converts this BigInteger to an integer value. If the value returned by this function is too big to fit into integer value, then it will return only the low-order 32 bits. Further there is chance that this conversion can lose information about the overall magnitude 2 min read BigInteger or() method in Java Prerequisite: BigInteger Basics The java.math.BigInteger.or(BigInteger val) method is used to perform bitwise OR of two BigIntegers. One of the BigInteger is passed in parameter and the other on which the function is called. This method returns a negative number if either of the BigIntegers used wit 2 min read Article Tags : Java Java-Functions java-math Java-BigInteger Java-math-package +1 More Practice Tags : JavaJava-BigInteger Like