public static byte[] reverse(byte[] array) {
        byte[] result = new byte[array.length];
        int front = 0;
        int back = array.length - 1;
        while (back >= 0) {
            result[front++] = array[back--];
        }
        return result;
    }
Checks that the range described by {@code offset} and {@code count}
doesn't exceed {@code arrayLength}.
common/src/main/java/org/conscrypt/ArrayUtils.java