if (aPos + length >= aLength || bPos + length >= bLength) {
if (aPos + length - 1 > aLength || bPos + length > bLength) {
    private static boolean equals(byte[] a, int aLength, int aPos, int length, byte[] b, int bLength, int bPos) {        if (aPos + length >= aLength || bPos + length >= bLength) {            return false;        }        for(int i = 0; i < length; i++) {            if (a[aPos + i] != b[bPos + i]) {                return false;            }        }        return true;    }