It depends on whether you just want to flag that they are different, or record each of the differences between them.
To merely check that they are different (as Hunter McMillen pointed out) - http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html:
boolean different = Arrays.equals(byteArray1, byteArray2);
To store the individual differences (assuming your pictures are of the same size):
byte[] differenceArray = new byte[byteArray1.length];
for (int i = 0; i < byteArray1.length; i++) {
differenceArray[i] = (byte) (byteArray1[i] - byteArray2[i]);
}
EDIT:
If you want two dimensions (eg 800x600) to your byte array, you could do:
byte[][] differenceArray = new byte[byteArray1.length][byteArray1[0].length];
for (int x = 0; x < byteArray1.length; x++) {
for (int y = 0; y < byteArray1[0].length; y++) {
differenceArray[x][y] = (byte) (byteArray1[x][y] - byteArray2[x][y]);
}
}
The difference array would be all 0 if there are no differences between the two images, otherwise the numbers would be the differences between the bytes.