We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 87871ef commit d402115Copy full SHA for d402115
src/main/java/com/thealgorithms/bitmanipulation/LowestSetBitManipulation.java
@@ -0,0 +1,13 @@
1
+public class LowestSetBit {
2
+
3
+ // Method to isolate the lowest set bit
4
+ public int isolateLowestSetBit(int n) {
5
+ if (n == 0) return 0; // Special case for 0
6
+ return n & -n;
7
+ }
8
9
+ // Method to clear the lowest set bit
10
+ public int clearLowestSetBit(int n) {
11
+ return n & (n - 1);
12
13
+}
0 commit comments