I'd prefer if this was really written to do it totally in place, rather than allocating a whole new array.