toArray

The returned array is sized to match exactly the number of elements of the stack.