When you print a byte array, the toString()
representation does not contain the contents of the array. Instead, it contains a type indicator ([B
means byte array) and the hashcode. The hashcode will be different for two distinct byte arrays, even if they contain the same contents. See Object.toString()
and Object.hashCode()
for further information.
Instead, you maybe want to compare the arrays for equality, using:
System.out.println("Arrays equal: " + Arrays.equals(uno_bytes, arr));