package leetcode;

/**
 * https://leetcode.com/problems/power-of-four/
 */
public class Problem342 {
    public boolean isPowerOfFour(int num) {
        // TODO:
        return false;
    }

    public static void main(String[] args) {
        Problem342 prob = new Problem342();
        System.out.println(prob.isPowerOfFour(16)); // true
        System.out.println(prob.isPowerOfFour(5)); // false
    }
}

@@ -150,254 +150,120 @@
     
-// TODO:%0A        return false;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem342 prob = new Problem342();%0A        System.out.println(prob.isPowerOfFour(16)); // true%0A        System.out.println(prob.isPowerOfFour(5)); // false
+double dval = Math.log10(num) / Math.log10(4);%0A        int ival = (int) dval;%0A        return (dval - ival == 0);
 %0A   

Solve problem 342