Efficiently create compact tree layouts in Java