a better way of transfer array