Here you can find the source of arrayEquals(Object[] arr1, Object[] arr2)
public static boolean arrayEquals(Object[] arr1, Object[] arr2)
//package com.java2s; //License from project: Apache License public class Main { public static boolean arrayEquals(Object[] arr1, Object[] arr2) { if (arr1 == null && arr2 == null) return true; if (arr1 == null ^ arr2 == null) return false; if (!arr1.getClass().equals(arr2.getClass())) return false; if (arr1.length != arr2.length) return false; for (int i = 0; i < arr1.length; ++i) { Object obj1 = arr1[i]; Object obj2 = arr2[i]; if (obj1 == null ^ obj2 == null) return false; if (obj1 != null && !obj1.equals(obj2)) return false; }/* w ww . j a v a2 s .co m*/ return true; } public static boolean arrayEquals(byte[] arr1, byte[] arr2) { if (arr1 == null && arr2 == null) return true; if (arr1 == null ^ arr2 == null) return false; if (!arr1.getClass().equals(arr2.getClass())) return false; if (arr1.length != arr2.length) return false; for (int i = 0; i < arr1.length; ++i) { byte b1 = arr1[i]; byte b2 = arr2[i]; if (b1 != b2) return false; } return true; } }