@Override
	public short getPrevious(short key) {
		if ((key < 0) || (key > maxKey)) {
			throw new IndexOutOfBoundsException();
		}
		boolean foundValue = false;
		short bestkey = 0;

		RBNode node = root;
		while (node != null) {
			if (key <= node.key) {
				node = node.left;
			}
			else {
				foundValue = true;
				bestkey = node.key;
				node = node.right;
			}

		}
		if (foundValue) {
			return bestkey;
		}
		return -1;

	}
Returns the largest key in the set that is less than the given key. Returns -1 if
there are not keys less than the given key.
@param key the key for which to find the previous key.
@exception IndexOutOfBoundsException thrown if the given key is not
in the range [0, maxKey].
Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/RedBlackKeySet.java