Here you can find the source of xorByteArrays(byte[] first, byte[] second)
public static byte[] xorByteArrays(byte[] first, byte[] second)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] xorByteArrays(byte[] first, byte[] second) { if (first.length != second.length) { System.err.println("Lengths of inputs are not equal!"); return null; }/*from w w w. j a va2s . co m*/ int length = first.length; byte[] result = new byte[length]; int i = 0; for (byte b : first) { result[i] = (byte) (b ^ second[i]); i++; } return result; } }