Skip to content

Commit 08890bc

Browse files
committed
Fixed Checkstyle issues in PowerOfFour.java
1 parent 7dfe84e commit 08890bc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.thealgorithms.bitmanipulation;
2+
3+
public class PowerOfFour {
4+
5+
private PowerOfFour() {
6+
throw new IllegalStateException("Utility class");
7+
}
8+
9+
public static boolean isPowerOfFour(int n) {
10+
if (n <= 0) {
11+
return false;
12+
} else {
13+
return (n & (n - 1)) == 0 && (n & 0x55555555) != 0;
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)