title: Printing specific path to a node in a binary tree
body: <p>I'm trying to use pre-order traversal to find a node in a binary tree made up of the characters a-z and A-Z, where going left is marked as "0" and going right is marked as "1", so that a correct output would look like "00" for a node that is two branches to the left. The nodes are not sorted.</p>
  
  <p>So far I have this:</p>
  
  <pre><code>static String routeNum = "";      
  
  private static String onePath(BinaryNodeInterface&lt;Character&gt; root, String route) {
  
      BinaryNodeInterface&lt;Character&gt; temp = root;
      if(temp != null){
  
      if(temp.hasLeftChild()){
        routeNum = onePath(temp.getLeftChild(),route+"0");
  
        }
        if(temp.hasRightChild()){
         routeNum = onePath(temp.getRightChild(), route+"1");
  
        }
      }
  
      System.out.print(route);
      return route;
  }
  </code></pre>
  
  <p>The output indicates that I am getting to the right nodes but it doesn't print the path.</p>