Imagine something like this: I have an array of 4 elements and I want to exchange the value between the element 1 and 3. How can I do this?
int[] i = new array[4];
i[0] = 10;
i[1] = 20;
i[2] = 30;
i[3] = 40;
if(something...)
{
i[1] = i[3]
i[3] = previous value of i[1]
}
I want this:
i[0] = 10;
i[1] = 40;
i[2] = 30;
i[3] = 20;
ANy idea?