I have a byte[4096] and was wondering what the fastest way is to check if all values are zero?
byte[4096]
Is there any way faster than doing:
byte[] b
For Java 8, you can simply use this:
public static boolean isEmpty(final byte[] data){ return IntStream.range(0, data.length).parallel().allMatch(i -> data[i] == 0); }