>>>表示无符号右移,左边空出的位以0填充
>>=右移赋值
>>>=无符号右移赋值
<<= 左移赋值
<<左移
1 class Solution { 2 // you need treat n as an unsigned value 3 public int reverseBits(int n) { 4 int res = 0; 5 for(int i = 0; i < 32; i++) { 6 res <<= 1; 7 res += n & 1; 8 n >>>= 1; 9 10 } 11 return res; 12 } 13 }
原文地址:https://www.cnblogs.com/goPanama/p/9393857.html
时间: 2024-12-15 11:03:49