```
class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t sum = 0;
uint32_t i = 31;
while ( n ) {
if ( n & 1 == 1 ) {
sum += ( 1 << i );
}
i--;
n >>= 1;
}
return sum;
}
};
```