How to I change the position in arrays
Alright, so what I want to do is presenting an array backward... so if I have an array of length 10 (1,2,3,4,5...) I want them to come out as 10, 9, 8...
I was thinking something along these lines:
public class uppg1 {
int[] array= {1,2,3,4,5,34,7,8,9,10};
int i;
public void summa(){
for (i=0; i<array.length; i++);{
for (int j=i+10; j<array.length; j++)
{
int tmp=array[i];
int array[i]=array[j];
array[j]=tmp;
}
}
}
buuut it doesnt seem to work, any tip? :)
regards, lenny