Here I just use the math to calculate the log value having base = 4.

```
public boolean isPowerOfFour(int num) {
return (Math.log(num)/Math.log(4) % 1== 0);
}
```

But I prefer the second one which is more readable:

```
public boolean isPowerOfFour(int num) {
double root = Math.log(num)/Math.log(4);
return (root % 1 == 0);
}
```