Java Utililty Methods Byte to Boolean Array

List of utility methods to do Byte to Boolean Array

Description

The list of methods to do Byte to Boolean Array are organized into topic(s).

Method

boolean[]byteToBooleanArray(byte b)
for byte b = "00000001 base 2", result[0] will be 1 (true) and result[7] will be 0 (false) boolean[] arr = byteToBooleanArray((byte)1); // binary: 00000001 System.out.println(arr[0]); // will display "true" System.out.println(arr[1]); // will display "false"
boolean[] result = new boolean[8];
for (int i = 0; i < result.length; i++)
    result[i] = (b & (1 << i)) != 0;
return result;
boolean[]byteToBooleanArray(byte byteVal)
byte To Boolean Array
boolean[] result = new boolean[6];
for (int i = 5; i > 0; i--) {
    result[i] = (byteVal & 0x01) != 0;
    byteVal >>= 1;
return result;
boolean[]byteToBooleanArray(byte input)
This method can be used to convert a byte into an array of boolean values.
boolean[] out = new boolean[8];
for (int i = 0; i < 8; i++) {
    if ((input & BIT_FLAGS[i]) == BIT_FLAGS[i])
        out[i] = true;
    else
        out[i] = false;
return out;
...