Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 026d053

Browse files
committedAug 17, 2020
solves power of 4
1 parent 3417ccd commit 026d053

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎src/PowerOf4.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class PowerOf4 {
2+
public static boolean isPowerOfFour(int number) {
3+
if (number == 0) {
4+
return false;
5+
}
6+
7+
while (number % 4 == 0) {
8+
number /= 4;
9+
}
10+
11+
return number == 1;
12+
}
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.