Android examples for java.lang:Byte Array
is Equal between two byte array
public class Main{ public static boolean isEqual(byte[] digesta, byte[] digestb) { if (digesta.length != digestb.length) { return false; }/* ww w .ja va 2s .co m*/ // Perform a constant time comparison to avoid timing attacks. int v = 0; for (int i = 0; i < digesta.length; i++) { v |= (digesta[i] ^ digestb[i]); } return v == 0; } }