protected void checkLengths(int len1, int len2) {
    	if (len1 != len2) {
            throw new IndexOutOfBoundsException("Invalid lengths: " + len1 + ", " + len2);
    	}
        if (len1 < 0) {
            throw new IndexOutOfBoundsException("Invalid length: " + len1);
        }
        if (len2 < 0) {
            throw new IndexOutOfBoundsException("Invalid length: " + len2);
        }
    }
Check that both specified lengths are valid (>= 0) and equal.

@param len1 length to check
@param len2 length to check
@throws IndexOutOfBoundsException if lengths are invalid
jphp-runtime/src/php/runtime/memory/support/IList.java