text: public boolean isValid() {if (bytes == null) {throw new IllegalStateException("bytes is null");}if (length < 0) {throw new IllegalStateException("length is negative: " + length);}if (length > bytes.length) {throw new IllegalStateException("length is out of bounds: " + length + ",bytes.length=" + bytes.length);}if (offset < 0) {throw new IllegalStateException("offset is negative: " + offset);}if (offset > bytes.length) {throw new IllegalStateException("offset out of bounds: " + offset + ",bytes.length=" + bytes.length);}if (offset + length < 0) {throw new IllegalStateException("offset+length is negative: offset=" + offset + ",length=" + length);}if (offset + length > bytes.length) {throw new IllegalStateException("offset+length out of bounds: offset=" + offset + ",length=" + length + ",bytes.length=" + bytes.length);}return true;}