added toArray() method to Stack