title: converting BST to array
body: <p>I've looked all over and can't seem to find any help for this.. for a school project I have a BST tree and I have to put all the ints from the tree into an int array called BSTarray.<br> This is what I have so far: <br></p>
  
  <pre><code>public int [] toBSTArray() {
      int size = 20;
      int [] BSTarray = new int [size];
      for(int i = 0; i &lt;size; i++) {
          makeArray(root);
          BSTarray[i] = root.getValue();
  }
  
      return BSTarray;
  }
  
  //helper method called by toBSTArray
  public void makeArray(BinarySearchTreeNode node) {
      if (node != null) {
          makeArray(node.getLeft());
          makeArray(node.getRight());
          // System.out.print(node.getValue() + " ");
      }
  }
  </code></pre>
  
  <p>I thought this method was supposed to go through the tree and add in the values it finds into different indexes in the BSTarray, but all it's doing is adding the same number into all the indexes in the array. Am I doing something wrong with the recursion?</p>