private final void
append(byte [] array, int start, int n) throws NameTooLongException {
	int length = (name == null ? 0 : (name.length - offset(0)));
	int alength = 0;
	for (int i = 0, pos = start; i < n; i++) {
		int len = array[pos];
		if (len > MAXLABEL)
			throw new IllegalStateException("invalid label");
		len++;
		pos += len;
		alength += len;
	}
	int newlength = length + alength;
	if (newlength > MAXNAME)
		throw new NameTooLongException();
	int labels = getlabels();
	int newlabels = labels + n;
	if (newlabels > MAXLABELS)
		throw new IllegalStateException("too many labels");
	byte [] newname = new byte[newlength];
	if (length != 0)
		System.arraycopy(name, offset(0), newname, 0, length);
	System.arraycopy(array, start, newname, length, alength);
	name = newname;
	for (int i = 0, pos = length; i < n; i++) {
		setoffset(labels + i, pos);
		pos += (newname[pos] + 1);
	}
	setlabels(newlabels);
}
The maximum number of cached offsets
src/main/java/core/org/xbill/DNS/Name.java