This can be done quickly with bitwise ops.

The tricky part is that there is no unsigned int in Java.

We should convert 'n' to a long before to play with bitwise ops in order to ignore sign extension.

```
public class Solution {
// you need treat n as an unsigned value
public int reverseBits(int n) {
long m = 0xFFFF_FFFFL & n;
m = ((m & 0x5555_5555) << 1) | ((m & 0xAAAA_AAAA) >> 1);
m = ((m & 0x3333_3333) << 2) | ((m & 0xCCCC_CCCC) >> 2);
m = ((m & 0x0F0F_0F0F) << 4) | ((m & 0xF0F0_F0F0) >> 4);
m = ((m & 0x00FF_00FF) << 8) | ((m & 0xFF00_FF00) >> 8);
m = ((m & 0x0000_FFFF) << 16) | ((m & 0xFFFF_0000) >> 16);
return (int) m;
}
}
```