title: Method to find the height of binary tree
body: <p>Can anybody help me rework this method to find the height of a binary tree. So far my code looks like this, however it is only working for small binary trees. It gives me a NullPointerException when I try to get the size of big trees. I’m not allowed to use any parameters for this task.</p>
  
  <pre><code>public int height() {
  int leftHeight = 0;
      int rightHeight = 0;
  if(this.left != null) leftHeight = this.left.height();
      if(this.right != null) rightHeight = this.right.height();
  
      if (leftHeight &gt; rightHeight)
          return (leftHeight + 1);
      else
          return (rightHeight + 1); 
  }
  </code></pre>