public int getTreeHeight() { return getTreeHeight(root); } private int getTreeHeight(Node currentNode) { if(currentNode == null) { return 0; } else { return 1+Math.max(getTreeHeight(currentNode.left),getTreeHeight(currentNode.right)); } }