Here you can find the source of compare(byte[] arr1, byte[] arr2)
public static boolean compare(byte[] arr1, byte[] arr2)
//package com.java2s; public class Main { public static boolean compare(byte[] arr1, byte[] arr2) { if (arr1 == null || arr2 == null) { return false; } else if (arr1.length != arr2.length) { return false; } else {/*from w ww. j a va2 s . c om*/ for (int i = 0; i < arr1.length; i++) { if (arr1[i] != arr2[i]) { return false; } } } return true; } }