标签:
public class Solution { public boolean isPowerOfTwo(int n) { int tmp = 1; for (int j = 0; j < 32; j++) { if (n == tmp) { return true; } if (tmp > n) { return false; } tmp = tmp << 1; } return false; } }
标签:
原文地址:http://www.cnblogs.com/vision-love-programming/p/4999533.html