update java's collection.toArray(Object) from traditional iteration