Here you can find the source of safeEquals(final byte[] obj1, final byte[] obj2)
public static boolean safeEquals(final byte[] obj1, final byte[] obj2)
//package com.java2s; import java.util.Arrays; public class Main { public static boolean safeEquals(final Object obj1, final Object obj2) { return obj1 == null && obj2 == null || !(obj1 == null || obj2 == null) && obj1.equals(obj2); }//from w w w.j a v a 2s . c o m public static boolean safeEquals(final Object[] obj1, final Object[] obj2) { return obj1 == null && obj2 == null || !(obj1 == null || obj2 == null) && Arrays.equals(obj1, obj2); } public static boolean safeEquals(final byte[] obj1, final byte[] obj2) { return obj1 == null && obj2 == null || !(obj1 == null || obj2 == null) && Arrays.equals(obj1, obj2); } }