uint32_t reverseBits(uint32_t n) { int arr[32] = {0}; int i=0; while(n) { arr[i++] = n % 2; n /= 2; } for(i=0; i<32; i++) { n += (arr[i])? pow(2,32-1-i): 0; } return n; }