Automatically balancing AVL trees in Java