Reverse Bits
思路一: 遍历 32 位 bit,记录 bit 结果
public int reverseBits(int n) {
int result = 0;
int x = 32;
while (x-- > 0) {
int bit = n & 1;
result <<= 1;
if (bit == 1) {
result++;
}
n >>>= 1;
}
return result;
}
标签:int,32,190,result,easy,bit,leetcode
From: https://www.cnblogs.com/iyiluo/p/16817285.html