您的位置:首页 > 其它

Leetcode-Reverse Bits

2015-05-11 18:14 375 查看
No.2二进制的移位思想

public class Solution {
public int reverseBits(int n) {
int count = 0;
for(int i=0; i<32; i++) {
count = 2*count + (n & 1);
n = n>>>1;
}
return count;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: