static BinaryField increment(BinaryField field, int maxLength) {

		byte[] bytes = field.getBinaryData();
		if (bytes == null) {
			return new BinaryField(new byte[0]);
		}

		int len = bytes.length;
		byte[] newBytes;
		if (len < maxLength) {
			// Simply increase length by adding trailing 0 byte
			newBytes = new byte[len + 1];
			System.arraycopy(bytes, 0, newBytes, 0, len);
			newBytes[len] = (byte) 0x00;
		}
		else if (bytes[len - 1] == (byte) 0xff) {
			// chop trailing ff bytes, increment new last byte
			int newLen = len;
			while (newLen > 0 && bytes[newLen - 1] == (byte) 0xff) {
				--newLen;
			}
			newBytes = new byte[newLen];
			System.arraycopy(bytes, 0, newBytes, 0, newLen);
			if (newLen > 0) {
				++newBytes[newLen - 1];
			}
			else {
				// wrap error
				Assert.fail("Bad test data: attempt to increment max value");
			}
		}
		else {
			// increment last byte only
			newBytes = new byte[len];
			System.arraycopy(bytes, 0, newBytes, 0, len);
			++newBytes[len - 1];
		}
		return new BinaryField(newBytes);
	}
Fill record with random data that falls int the middle range for
the value type. The middle range is considered form half the min value
to half the max value. It only applies to byte, short, int, and long currently.
@param rec record
@param varDataSize number of bytes to fill into all variable length fields.
A value less than 0 results in a null assignment to those fields.
Ghidra/Framework/DB/src/test/java/db/DBTestUtils.java