Java Iterate Bits in Byte Array
You’d have to write your own implementation of Iterable<Boolean> which took an array of bytes, and then created Iterator<Boolean> values which remembered the current index into the byte array and the current index within the current byte. Then a utility method like this would come in handy: private static Boolean isBitSet(byte b, int bit) { … Read more