Hello
if i have an array consist of 5 integers from 1 to 5 like this
- int [] numbers={1,2,3,4,5};
So, i want to swap the last number (5) with the first number (1)
And
Swap the second number (2) with the fourth number (4)
So the number 3 (which is in the middle will stay in the middle with index of 2).
I tried to swap between the first and last number in this manner:
But i don't know if this is true, and what about the second swapping?