Move newArray and its relatives to util