List of utility methods to do Bits Convert to
long | bitToLong(byte[] bytes, int offset, int length) Interpret a BIT value as an integer. int shift = 0; long[] steps = new long[length]; for (int i = offset + length - 1; i >= offset; i--) { steps[i] = (long) (bytes[i] & 0xff) << shift; shift += 8; long valueAsLong = 0; for (int i = 0; i < length; i++) { ... |
boolean | bitValueHelper(final int index, final int[] data) bit Value Helper final int arrayIndex = index / Integer.SIZE; final int arrayOffset = index % Integer.SIZE; final int entry = data[arrayIndex]; final int value = (entry & (1 << arrayOffset)); return value != 0; |
void | bitWiseAnd(final byte[] array1, final byte[] array2) Combine two arrays by doing the logic And byte by byte. if (array1 == null || array2 == null) { throw new IllegalArgumentException("Input data cannot be null"); if (array1.length != array2.length) { throw new IllegalArgumentException("Arrays must have the same length"); for (int i = 0; i < array1.length; i++) { array1[i] &= array2[i]; ... |