### Question:
ArrayUtil { public static int hashCode(Object obj) { if (obj == null) { return 0; } final Class<?> clazz = obj.getClass(); if (!clazz.isArray()) { return obj.hashCode(); } final Class<?> componentType = clazz.getComponentType(); if (long.class.equals(componentType)) { return Arrays.hashCode((long[]) obj); } else if (int.class.equals(componentType)) { return Arrays.hashCode((int[]) obj); } else if (short.class.equals(componentType)) { return Arrays.hashCode((short[]) obj); } else if (char.class.equals(componentType)) { return Arrays.hashCode((char[]) obj); } else if (byte.class.equals(componentType)) { return Arrays.hashCode((byte[]) obj); } else if (boolean.class.equals(componentType)) { return Arrays.hashCode((boolean[]) obj); } else if (float.class.equals(componentType)) { return Arrays.hashCode((float[]) obj); } else if (double.class.equals(componentType)) { return Arrays.hashCode((double[]) obj); } else { return Arrays.hashCode((Object[]) obj); } }  static int hashCode(Object obj); static boolean equals(Object thisObj, Object thatObj); static String toString(Object obj);  }### Answer:
@Test public void testHashCode() throws Exception { Object arr; arr = new long[] { 1 }; assertEquals(Arrays.hashCode((long[]) arr), ArrayUtil.hashCode(arr)); arr = new int[] { 1 }; assertEquals(Arrays.hashCode((int[]) arr), ArrayUtil.hashCode(arr)); arr = new short[] { 1 }; assertEquals(Arrays.hashCode((short[]) arr), ArrayUtil.hashCode(arr)); arr = new char[] { 1 }; assertEquals(Arrays.hashCode((char[]) arr), ArrayUtil.hashCode(arr)); arr = new byte[] { 1 }; assertEquals(Arrays.hashCode((byte[]) arr), ArrayUtil.hashCode(arr)); arr = new boolean[] { true }; assertEquals(Arrays.hashCode((boolean[]) arr), ArrayUtil.hashCode(arr)); arr = new float[] { 1f }; assertEquals(Arrays.hashCode((float[]) arr), ArrayUtil.hashCode(arr)); arr = new double[] { 1d }; assertEquals(Arrays.hashCode((double[]) arr), ArrayUtil.hashCode(arr)); arr = new Object[] { "str" }; assertEquals(Arrays.hashCode((Object[]) arr), ArrayUtil.hashCode(arr)); assertEquals(0, ArrayUtil.hashCode(null)); assertEquals("str".hashCode(), ArrayUtil.hashCode("str")); assertEquals(Integer.valueOf(1).hashCode(), ArrayUtil.hashCode(1)); }
@Test void testHashCode() { Object arr; arr = new long[]{1}; assertEquals(Arrays.hashCode((long[]) arr), ArrayUtil.hashCode(arr)); arr = new int[]{1}; assertEquals(Arrays.hashCode((int[]) arr), ArrayUtil.hashCode(arr)); arr = new short[]{1}; assertEquals(Arrays.hashCode((short[]) arr), ArrayUtil.hashCode(arr)); arr = new char[]{1}; assertEquals(Arrays.hashCode((char[]) arr), ArrayUtil.hashCode(arr)); arr = new byte[]{1}; assertEquals(Arrays.hashCode((byte[]) arr), ArrayUtil.hashCode(arr)); arr = new boolean[]{true}; assertEquals(Arrays.hashCode((boolean[]) arr), ArrayUtil.hashCode(arr)); arr = new float[]{1f}; assertEquals(Arrays.hashCode((float[]) arr), ArrayUtil.hashCode(arr)); arr = new double[]{1d}; assertEquals(Arrays.hashCode((double[]) arr), ArrayUtil.hashCode(arr)); arr = new Object[]{"str"}; assertEquals(Arrays.hashCode((Object[]) arr), ArrayUtil.hashCode(arr)); assertEquals(0, ArrayUtil.hashCode(null)); assertEquals("str".hashCode(), ArrayUtil.hashCode("str")); assertEquals(Integer.valueOf(1).hashCode(), ArrayUtil.hashCode(1)); }