My solution with bit manipulation:

class Solution(object):

```
def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
ret = 0
for i in range(32):
if n & (1 << i): # update ret (31-i)th bit when the ith bit at n is '1'
ret |= 1 << (31 - i)
return ret
```