Binary Search Tree into array

Hi, i need to store the nodes of a given binary search tree into an array in ascending order. i have come up with this:

publicstaticint[] collectNodesHelper(tree t){

int totalNodes = 0;

if(!isempty(t)){

collectNodesHelper(Left(t));

totalNodes = totalNodes + 1;

collectNodesHelper(Right(t));

}

int[] arr =newint[totalNodes];

for (int i=0; i<totalNodes; i++){

arr[i] = Root(t);

}

return arr;

}

which i'm fairly sure should work, but i am unsure about how to return - because where the statement is now, it says it cannot access variable arr.>

[1166 byte] By [chrissmith51a] at [2007-11-26 17:14:55]
# 1
縃ow is the Tree class?TreeSet implements toArray() method, see its implementation.
govisagod512a at 2007-7-8 23:42:54 > top of Java-index,Java Essentials,Java Programming...
# 2
縃ow is the Tree class?TreeSet implements toArray() method, see its implementation.
govisagod512a at 2007-7-8 23:42:54 > top of Java-index,Java Essentials,Java Programming...
# 3
this is a custom tree class. it's not how the method works thats the problem i dont think, its just how i can return the array within it.
chrissmith51a at 2007-7-8 23:42:54 > top of Java-index,Java Essentials,Java Programming...