We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9627eab commit 5bea3a7Copy full SHA for 5bea3a7
src/main/java/com/thealgorithms/bitmanipulation/HighestSetBit.java
@@ -40,12 +40,10 @@ public static Optional<Integer> findHighestSetBit(int num) {
40
}
41
42
if (num == 0) {
43
- return Optional.empty(); // No bits are set in 0
+ return Optional.empty();
44
45
46
int position = 0;
47
-
48
- // Right-shift the number until it becomes zero, counting the number of shifts
49
while (num > 0) {
50
num >>= 1;
51
position++;
0 commit comments