Here you can find the source of bitReverse31(int i)
Parameter | Description |
---|---|
i | The integer to reverse the bits of. |
private static final int bitReverse31(int i)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w.jav a2 s .c o m*/ * Reverse the 31 low order bits used to comprise the integer i. * * The highorder bit is ignored because it is the signed bit. * * @param i The integer to reverse the bits of. * * @return The reversed bits. */ private static final int bitReverse31(int i) { return ((i >>> 30) & 0x00000001) | ((i << 30) & 0x40000000) | ((i >>> 28) & 0x00000002) | ((i << 28) & 0x20000000) | ((i >>> 26) & 0x00000004) | ((i << 26) & 0x10000000) | ((i >>> 24) & 0x00000008) | ((i << 24) & 0x08000000) | ((i >>> 22) & 0x00000010) | ((i << 22) & 0x04000000) | ((i >>> 20) & 0x00000020) | ((i << 20) & 0x02000000) | ((i >>> 18) & 0x00000040) | ((i << 18) & 0x01000000) | ((i >>> 16) & 0x00000080) | ((i << 16) & 0x00800000) | ((i >>> 14) & 0x00000100) | ((i << 14) & 0x00400000) | ((i >>> 12) & 0x00000200) | ((i << 12) & 0x00200000) | ((i >>> 10) & 0x00000400) | ((i << 10) & 0x00100000) | ((i >>> 8) & 0x00000800) | ((i << 8) & 0x00080000) | ((i >>> 6) & 0x00001000) | ((i << 6) & 0x00040000) | ((i >>> 4) & 0x00002000) | ((i << 4) & 0x00020000) | ((i >>> 2) & 0x00004000) | ((i << 2) & 0x00010000); } }