private static boolean arrEquals(byte[] a1, byte[] a2) { if (a1 == a2) return true; if (a1 == null || a2 == null) return false; int length = a1.length; if (a2.length != length) return false; int j = 0, k = 1; while (j < length) { if (a1[j] != a2[j]) return false; j += 2; } while (k < length) { if (a1[k] != a2[k]) return false; k += 2; } return true; }
原文:http://www.cnblogs.com/czpblog/p/5049705.html