Java for LeetCode 231 Power of Two
public boolean isPowerOfTwo(int n) {
if(n<1)
return false;
while(n!=1){
if(n%2!=0)
return false;
n>>=1;
}
return true;
}
public boolean isPowerOfTwo(int n) {
if(n<1)
return false;
while(n!=1){
if(n%2!=0)
return false;
n>>=1;
}
return true;
}