Reverses an array in place.