Диаметр бинарного дерева - лучший дизайн

Я написал код для определения диаметра бинарного дерева. Нужны предложения по следующему:

Can I do this without using static variable at class level?

Is the algorithm fine/any suggestions?

public class DiameterOfTree {   
public static int diameter = 0; 
public static int getDiameter(BinaryTreeNode root) {        
    if (root != null) {                     
        int leftCount = getDiameter(root.getLeft());
        int rightCount = getDiameter(root.getRight());
        if (leftCount + rightCount > diameter) {
            diameter = leftCount + rightCount;
            System.out.println("---diameter------------->" + diameter);
        }           
        if ( leftCount > rightCount) {
            return leftCount + 1;
        }
        return rightCount + 1;
    }
    return 0;
  }
}

Ответы на вопрос(9)

Ваш ответ на вопрос