after byte operations, the bytes need to be cast back to byte;
"Whether you apply the (int) casts or not, byte1 and byte2 will both be promoted to int before the operation. That is also why the cast back to (byte) is necessary."
https://stackoverflow.com/questions/24004579/xor-bytes-in-java