Here you can find the source of xorArrays(byte[] a, byte[] b)
Parameter | Description |
---|---|
a | the first array. |
b | the second array. |
public static byte[] xorArrays(byte[] a, byte[] b)
//package com.java2s; public class Main { /**// w w w . j a v a2 s . c o m * Computes array-wise XOR. * * @param a * the first array. * @param b * the second array. * @return the XOR-ed array. */ public static byte[] xorArrays(byte[] a, byte[] b) { byte[] xor = new byte[a.length]; for (int i = 0; i < a.length; i++) { xor[i] = (byte) (a[i] ^ b[i]); } return xor; } }