位操作2的幂次数2 104 1008 100016 10000... 1 class Solution { 2 /* 3 * @param n: An integer 4 * @return: True or false 5 */ 6 public boolean checkPowerOf2(int n) { 7 // write your code here 8 return ((n > 0) && ((n & (n - 1)) == 0)); 9 } 10 };