```
private int[] reverseHex = new int[] {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};
// you need treat n as an unsigned value
public int reverseBits(int n) {
int rev = 0;
while (n != 0) {
rev = (rev << 4) + reverseHex[n & 0xF];
n >>>= 4;
}
return rev;
}
```

- Create an array that contains the reverse number of 0-15.
- Divide the number into 8 parts, each part has 4 bits which can represent number 0-15. Get the reverse number of each part using the array.