i'm creating a method to find the distance between a particular node and the root of the tree it is in, and i wanted to verify if this is the simplest way to do so. i was slightly worried that holder would become the original node, and thus as i am moving up the tree, i am pulling said node up with me.

```
    public int distanceToRoot(Node node)
{
    Node holder= node;
    int distance=0;
    if (node.getParent()==null)
    {
        distance=0;
    }
    else
    {
        while (holder.getParent() !=null)
            {
            holder=holder.getParent();
            distance++;
            }
    }
    return distance;
}

```