Given an integer, write a function to determine if it is a power of two.
题目链接:https://leetcode.com/problems/power-of-two/
题目分析:大于0且二进制中只有一位为1
public class Solution {
public boolean isPowerOfTwo(int n) {
return n > 0 && (n & (n - 1)) == 0;
}
}