private Node getByIndex(int index) {
			if (index < 0) {
				throw new IndexOutOfBoundsException(Integer.toString(index));
			}
			Node cur = this;
			int i = index;
			while (true) {
				if (i < 0) {
					throw new AssertionError("INTERNAL: sizeLeft values inconsistent");
				}
				else if (cur == null) {
					throw new IndexOutOfBoundsException(Integer.toString(index));
				}
				else if (i == cur.sizeLeft) {
					return cur;
				}
				else if (i > cur.sizeLeft) {
					i -= cur.sizeLeft;
					i--;
					cur = cur.rChild;
				}
				else {
					cur = cur.lChild;
				}
			}
		}
Retrieve the node at a given index in this subtree

This really only makes sense at the root

@param index the index
@return the node at the given index
Ghidra/Framework/Generic/src/main/java/ghidra/generic/util/datastruct/TreeValueSortedMap.java