protected void checkLength(int len) {
        if (len < 0) {
            throw new IndexOutOfBoundsException("Invalid length: " + len);
        }
    }
Check that specified length is valid (>= 0).

@param len length to check
@throws IndexOutOfBoundsException if length is invalid
jphp-runtime/src/php/runtime/memory/support/IList.java