Skip to content

Commit 8b5c7c7

Browse files
linter solve
1 parent 51e93f9 commit 8b5c7c7

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/main/java/com/thealgorithms/bitmanipulation/HighestSetBit.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ public final static Optional<Integer> findHighestSetBit(int num) {
1414
if (num < 0) {
1515
throw new IllegalArgumentException("Input cannot be negative");
1616
}
17-
17+
1818
if (num == 0) {
1919
return Optional.empty();
2020
}
21-
21+
2222
int position = 0;
2323
while (num > 0) {
2424
num >>= 1;
2525
position++;
2626
}
27-
27+
2828
return Optional.of(position - 1);
2929
}
3030
}

src/test/java/com/thealgorithms/bitmanipulation/HighestSetBitTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ void testHighestSetBit() {
1616
assertEquals(5, HighestSetBit.findHighestSetBit(37).orElse(-1));
1717
assertFalse(HighestSetBit.findHighestSetBit(0).isPresent());
1818
assertEquals(0, HighestSetBit.findHighestSetBit(1).orElse(-1));
19-
20-
// Use assertThrows with a specific exception type and provide a lambda
2119
assertThrows(IllegalArgumentException.class, () -> HighestSetBit.findHighestSetBit(-37).orElse(-1));
2220
}
23-
}
24-
21+
}

0 commit comments

Comments
 (0)