LeetCode: Power of Four

LeetCode: Power of Four

1
2
3
4
5
public class Solution {
public boolean isPowerOfFour(int num) {
return num > 0 && (num & (num - 1)) == 0 && (0x55555555 & num) != 0;
}
}