// null 元素是相等的.
boolean[] barr1 = null;
boolean[] barr2 = null;
boolean b = arrays.equals(barr1, barr2); // true
// 比较两个boolean数组.
barr1 = new boolean[]{true, false};
barr2 = new boolean[]{true, false};
b = arrays.equals(barr1, null); // false
b = arrays.equals(barr1, barr2); // true
// 对于原生类型的数组可以用equals().
b = arrays.equals(new byte[]{0}, new byte[]{0}); // true
b = arrays.equals(new char[]{a}, new char[]{a}); // true
b = arrays.equals(new short[]{0}, new short[]{0}); // true
b = arrays.equals(new int[]{0}, new int[]{0}); // true
b = arrays.equals(new long[]{0l}, new long[]{0l}); // true
b = arrays.equals(new float[]{0f}, new float[]{0f}); // true
b = arrays.equals(new double[]{0d}, new double[]{0d}); // true
// 如果比较的是object型的数组,null元素是相等的.
// 如果于元素不是null, java虚拟机会自动调用object.equals().
b = arrays.equals(new string[]{"a"}, new string[]{"a"}); // true
b = arrays.equals(new string[]{null}, new string[]{null}); // true
b = arrays.equals(new string[]{"a"}, new string[]{null}); // false