public int getHeight() {
    if (this.isEmpty())
      return 0;
    if (this.isLeaf())
      return 1;
    if (this.left == null)
      return 1 + this.right.getHeight();
    if (this.right == null)
      return 1 + this.left.getHeight();
    return 1 + Math.max(this.left.getHeight(), this.right.getHeight());
  }