Find the size and depth of a tree I have tried to implement two methods, one for finding the size of the tree and the other for finding the height of the tree. Can they be optimized further?

  package trees;
  import java.util.LinkedList;
  import java.util.TreeSet;
public class TreeNodeImpl {



    public TreeNodeImpl left ; 
    public TreeNodeImpl right; 
    public int Value ;
    public int height=1;

    public TreeNodeImpl newTreeNode(int value){
        TreeNodeImpl newNode = new TreeNodeImpl();
        newNode.Value = value;
        newNode.left = null;
        newNode.right = null ; 
        return  newNode;
    }

    public int   recSize(TreeNodeImpl node ){
            if(node == null){
                return 0 ;
            }
            else{
                return( recSize(node.left)+ 1 + recSize(node.right));
            }
    }
    public int recHeight(TreeNodeImpl node){

        if(node==null)
        {
            return 0;
        }
        else {


            if(node.left!=null||node.right!=null){
                height++;
                recHeight(node.left);
                recHeight(node.right);
            }
        return height;
        }
    }

    public static void main(String[] args) {
        TreeNodeImpl node = new TreeNodeImpl();
        node.Value = 6;
        node.left= node.newTreeNode(20);
        node.left.left = node.newTreeNode(30);
        node.right= node.newTreeNode(30);
        node.left.left.right = node.newTreeNode(34);
        node.left.left.left = node.newTreeNode(34);
        int Size = node.recSize(node);
        System.out.println(Size);
        int height = node.recHeight(node);
        System.out.println(height);
    }
}
The formatting is all over the place, which is distracting and makes the code hard to read.

The suffix Impl in TreeNodeImpl is unnecessary, as are the rec prefixes for recSize and recHeight.

It's not clear why newTreeNode should exist; this looks like work that should be done in a constructor.

Neither of the imports java.util.LinkedList and java.util.TreeSet are used and should be removed.

Having recSize and recHeight take a node as a parameter leads to strange-looking code like node.recSize(node).

The biggest problem though is that successive calls to recHeight will return different values.