static void checkOffsetAndCount(int arrayLength, int offset, int count) {
        if ((offset | count) < 0 || offset > arrayLength || arrayLength - offset < count) {
            throw new ArrayIndexOutOfBoundsException("length=" + arrayLength + "; regionStart="
                    + offset + "; regionLength=" + count);
        }
    }
Checks that the range described by {@code offset} and {@code count}
doesn't exceed {@code arrayLength}.
common/src/main/java/org/conscrypt/ArrayUtils.java