```
def isPowerOfFour(self, num):
"""
:type num: int
:rtype: bool
"""
while num > 0 and num & 3 == 0:
num >>= 2
return num == 1
```

Explanation:

1 is a power of 4 (4^0). Any power of 4 has 1 followed by an even number of 0s in its binary representation, so 3 (0b11) it can never be anded with 3 and yield anything, unless it's reached the end, in which case we check if it's equal to 1.