和 reverse Bits同一类型

 

代码:

public class Solution {
// you need treat n as an unsigned value
public int reverseBits(int n) {
int result = 0;
for(int i = 32; i > 0; i--){
result = result << 1;
result = result + (n & 1);
n = n >>> 1;
}
return result;
}
}

posted on 2016-01-10 04:35  爱推理的骑士  阅读(114)  评论(0编辑  收藏  举报