Here you can find the source of areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty)
public static boolean areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static boolean areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty) { if (!dontDistinctNilAndEmpty) return Arrays.equals(arr1, arr2); if (arr1 == null || arr1.length == 0) return arr2 == null || arr2.length == 0; return Arrays.equals(arr1, arr2); }//from w w w.j a v a 2 s . c o m }