added in-place array reversal method