Here you can find the source of xor(byte[] data1, byte[] data2)
public static byte[] xor(byte[] data1, byte[] data2)
//package com.java2s; public class Main { public static byte[] xor(byte[] data1, byte[] data2) { byte[] xored = new byte[data1.length]; for (int i = 0; i < xored.length; i++) { xored[i] = (byte) (data1[i] ^ data2[i]); }//from w w w . jav a 2s . c o m return xored; } }