swap works for ints and array of ints