List of utility methods to do Boolean Array to Byte Array Convert
byte[] | createByteArr(boolean[] booleans) create Byte Arr int length = booleans.length; byte[] bytes = new byte[length / 8 + 1]; for (int i = 0; i < length; i++) { if (!booleans[i]) continue; int word = i >>> 3; bytes[word] |= 1 << (i & 7); return bytes; |
byte[] | createByteArr(boolean[] booleans) create Byte Arr int length = booleans.length; byte[] bytes = new byte[length / 8 + 1]; for (int i = 0; i < length; i++) { if (!booleans[i]) continue; int word = i >>> 3; bytes[word] |= 1 << (i & 7); return bytes; |