Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).
题意:将一个整数的二进制表示逆转,得到逆转后的数
思路:转换不难,但题目要求优化该函数在多次调用时的性能表现,那就要做缓存了,如果只缓存某个数字,意义不大;但int是一个4字节数,我们可以缓存其字节
代码:
private final Map<Byte, Integer> cache = new HashMap<Byte, Integer>();
public int reverseBits(int n) {
byte[] bytes = new byte[