code: private TreeNode<T> balanceOut(){
  		int balance = height(left) - height(right);
  		if (balance < -1){
  			// The tree is right-heavy.
  			if (height(right.left) > height(right.right)){
  				this.right = this.right.rightRotate();
  				return leftRotate();
  			} else{
  				return leftRotate();
  			}
  		} else if (balance > 1){
  			// The tree is left-heavy.
  			if (height(left.right) > height(left.left)){
  				this.left = this.left.leftRotate();
  				return rightRotate();
  			} else
  				return rightRotate();
  		} else {
  			// The tree is already balanced.
  			return this;
  		}
  	}
docs: Checks if the subtree rooted at the current node is balanced and balances it
  if necessary.
  
  @return The new root of the subtree, after the balancing operation has been
  performed. It may return a {@code null} value, if the balancing has been
  triggered by a {@link #removeInterval(IntervalTree, TreeNode, Interval)} operation
  and the removed interval had been the last one in the subtree.