Here you can find the source of equals(byte[] array1, byte[] array2)
public static boolean equals(byte[] array1, byte[] array2)
//package com.java2s; public class Main { public static boolean equals(byte[] array1, byte[] array2) { if ((array1 == null && array2 != null) || (array1 != null && array2 == null)) return false; else if (array1 != null && array2 != null) { if (array1.length != array2.length) return false; for (int i = array1.length; --i >= 0;) if (array1[i] != array2[i]) return false; }//from ww w . ja va2 s . c o m return true; } }