toBooleanArray
public static boolean[] toBooleanArray(byte[] byteArray,
int numberOfBooleansInArray)
This function is intended to be called from the Python API with the result of np.packbits(...).toBytes().
In Python, the result of this is a byte array where each boolean is represented by a single bit (0 for false, 1 for true).
When put into a bytearray, these bits may need to be padded with up to 7 bits to make a whole number of bytes.
Therefore, the function requires the parameter numberOfBooleansInArray to know which bits are padding bits and which are booleans.
- Parameters:
byteArray - an array of bytes where booleans (in little endian form) are represented by single bits.
numberOfBooleansInArray - the number of booleans represented by the bits in the bytearray
- Returns:
- an array of booleans