Is there any way to move items inside an array? For example:
int[] myArray = {1,2,3,4};
2nd element becomes the last:
int[] myArray = {1,3,4,2};
P.S.: No that's not a homework. I can think of at least one solution but it requires rather difficult implementation:
- First we save second element to Int
- then we remove this element from the array
- then we add new element at the very end of my array
Any other (read - easier) way to do this?