Java for LeetCode 190 Reverse Bits

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).

JAVA实现如下:

    public int reverseBits(int n) {
         return Integer.reverse(n);
    }

 

posted @ 2015-06-06 21:40  TonyLuis  阅读(202)  评论(0编辑  收藏  举报