标签:enum san ffffff could line ica als ret ack
2017/3/23 22:23:57
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it without loops/recursion?
publicclassSolution{
publicboolean isPowerOfFour(int num){
return num >0&&( num & num -1 |num &0x2AAAAAAA )==0;
}
}
标签:enum san ffffff could line ica als ret ack
原文地址:http://www.cnblogs.com/flyfatty/p/6624810.html