Ok, I think I understand what you mean. Now, a pretty significant mistake is that it does not work with negative numbers. However, assuming that you are not using it to read input files, you can still use it.
public static ArrayList<Boolean> toBitArr(byte[] bytearr){ ArrayList<Boolean> bitarr = new ArrayList<Boolean>(); ArrayList<Boolean> temp = new ArrayList<Boolean>(); int i = 0; for(byte b: bytearr){ while(Math.abs(b) > 0){ temp.add((b % 2) == 1); b = (byte) (b >> 1); } Collections.reverse(temp); bitarr.addAll(temp); temp.clear(); } return bitarr; }
Pizzamonkey
source share