List of utility methods to do Byte Array to Boolean
boolean | bytesToBoolean(byte[] buffer) This function converts the bytes in a byte array to its corresponding boolean value. return bytesToBoolean(buffer, 0);
|
boolean[] | bytesToBooleanArray(byte[] input) A method that performs the same function as the bytesToBooleanArray() method but is not limited by input and output size. boolean[] out = new boolean[input.length * 8]; int pos = 0; for (int i = 0; i < input.length; i++) { for (int j = 0; j < 8; j++, pos++) { if ((input[i] & BIT_FLAGS[j]) == BIT_FLAGS[j]) out[pos] = true; else out[pos] = false; ... |
boolean[] | bytesToBooleans(byte[] bytes) Converts a byte[] into a boolean[] Each bit is converted into a boolean value and placed in a boolean[]. int tempValue = 0; boolean[] booleans = new boolean[bytes.length * 8]; for (int b = bytes.length - 1; b >= 0; b--) { for (int j = 0; j < 8; j++) { tempValue = (bytes[b] >> j) & 0x01; if (tempValue == 1) { booleans[((bytes.length - 1 - b) * 8) + j] = true; } else { ... |
boolean | byteToBoolean(byte[] b) byte To Boolean if ((b[0] & 0xFF) == 0) { return false; } else { return true; |
boolean[] | byteToBoolean(byte[] byt) Convert an array of bytes to booleans boolean[] bool = new boolean[byt.length]; for (int i = 0; i < byt.length; i += 1) { bool[i] = byt[i] == 'T'; return bool; |
boolean[] | byteToBoolean(byte[] values) byte To Boolean if (values == null) { return null; boolean[] results = new boolean[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (values[i] != 0); return results; ... |