思路:循环右移
// @Title: 颠倒二进制位 (Reverse Bits)
// @Author: qisiii
// @Date: 2022-03-11 10:15:53
// @Runtime: 0 ms
// @Memory: 40.6 MB
// @comment: 循环右移
// @flag: BLUE
public class Solution {
// you need treat n as an unsigned value
public int reverseBits(int n) {
int result=0;
for(int i=1;i<32;i++){
result=result|(n&1);
n=n>>>1;
result=result<<1;
}
result=result|(n&1);
return result;
}
}