Java Utililty Methods Bits Convert to

List of utility methods to do Bits Convert to

Description

The list of methods to do Bits Convert to are organized into topic(s).

Method

intbitReverse31(int i)
Reverse the 31 low order bits used to comprise the integer 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)
...
voidbitrv208(double[] a, int offa)
bitrv
double x1r, x1i, x3r, x3i, x4r, x4i, x6r, x6i;
x1r = a[offa + 2];
x1i = a[offa + 3];
x3r = a[offa + 6];
x3i = a[offa + 7];
x4r = a[offa + 8];
x4i = a[offa + 9];
x6r = a[offa + 12];
...
voidbitrv208neg(double[] a, int offa)
bitrvneg
double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, x5r, x5i, x6r, x6i, x7r, x7i;
x1r = a[offa + 2];
x1i = a[offa + 3];
x2r = a[offa + 4];
x2i = a[offa + 5];
x3r = a[offa + 6];
x3i = a[offa + 7];
x4r = a[offa + 8];
...
voidbitrv216neg(double[] a, int offa)
bitrvneg
double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, x5r, x5i, x6r, x6i, x7r, x7i, x8r, x8i, x9r, x9i, x10r, x10i,
        x11r, x11i, x12r, x12i, x13r, x13i, x14r, x14i, x15r, x15i;
x1r = a[offa + 2];
x1i = a[offa + 3];
x2r = a[offa + 4];
x2i = a[offa + 5];
x3r = a[offa + 6];
x3i = a[offa + 7];
...
voidbitrv2conj(int n, int[] ip, double[] a, int offa)
bitrvconj
int j1, k1, l, m, nh, nm;
double xr, xi, yr, yi;
int idx0, idx1, idx2;
m = 1;
for (l = n >> 2; l > 8; l >>= 2) {
    m <<= 1;
nh = n >> 1;
...
floatbits2float(int i)
bitsfloat
float res = Float.intBitsToFloat(i);
return res;
intbits2Numeric(boolean[] in)
Converts a vector of booleans to a numeric representation.
int numeric = 0;
for (int i = 0; i < in.length; i++) {
    if (in[i])
        numeric += 1 << i;
return numeric;
bytebitsArrayToByte(byte[] bits)
This method convert a 8-bytes array to a single byte.
byte temp = 0;
for (int i = 0; i < bits.length; i++) {
    temp |= bits[i] << (7 - i);
return (byte) (temp + 128);
intbitscanForward(long bitboard)
Returns the next 1 bit in the bitboard.
return bitScanForwardDeBruijn64(bitboard);
int[]bitsCleanup(int base, int[] bits)
bits Cleanup
int i = 0;
if (isNegative(base, bits)) {
    for (; i < bits.length && bits[bits.length - i - 1] == base - 1; i++)
        ;
} else {
    for (; i < bits.length && bits[bits.length - i - 1] == 0; i++)
        ;
if (i > 0) {
    int[] clean = new int[bits.length - i + 1];
    System.arraycopy(bits, 0, clean, 0, clean.length);
    return clean;
} else {
    return bits;