class Arrays2 {

    public static <T> boolean arrayEquals(T oldValue, T newValue) {
        if (isArray(oldValue) && isArray(newValue) && oldValue.getClass().getComponentType().equals(newValue.getClass().getComponentType())) {
            Class<?> type = oldValue.getClass().getComponentType();
            if (type.equals(long.class)) {
                return Arrays.equals((long[]) oldValue, (long[]) newValue);
            } else if (type.equals(int.class)) {
                return Arrays.equals((int[]) oldValue, (int[]) newValue);
            } else if (type.equals(short.class)) {
                return Arrays.equals((short[]) oldValue, (short[]) newValue);
            } else if (type.equals(char.class)) {
                return Arrays.equals((char[]) oldValue, (char[]) newValue);
            } else if (type.equals(byte.class)) {
                return Arrays.equals((byte[]) oldValue, (byte[]) newValue);
            } else if (type.equals(boolean.class)) {
                return Arrays.equals((boolean[]) oldValue, (boolean[]) newValue);
            } else if (type.equals(double.class)) {
                return Arrays.equals((double[]) oldValue, (double[]) newValue);
            } else if (type.equals(float.class)) {
                return Arrays.equals((float[]) oldValue, (float[]) newValue);
            } else {
                return Arrays.equals((Object[]) oldValue, (Object[]) newValue);
            }
        }
        return false;
    }

    private  Arrays2();

}