```
public class Solution {
public boolean isPowerOfFour(int num) {
// 1. Largest int which is power of 4 should be 2^30 = 4^15.
// So the largest int 4^15 mod the num should be always 0.
// 2. But the power of 4 will also be dividable by 2, which means nums like 2^3 should also be checked.
// Then "Math.sqrt(num)%2 == 0" will filter out those invalid nums.
// 3. Don't forget 1
return (Math.pow(4, 15) % num == 0 && Math.sqrt(num)%2 == 0) || num == 1;
}
}
```