2
How do I reverse the values of a vector? Example:
1 2 3
turn 3 2 1
I am currently trying to make a method of the type..
public static int [] vetorInvertido(int [] vet){
int [] vetInvert = new int[vet.length];
for(int i=vet.length-1;i>=0;i--){
for(int j=0; j<=vetInvert.length; j++){
vetInvert[j] = vet[i];
}
}
return vetInvert;
}
Duplicate Stack in English, for a look: http://stackoverflow.com/a/2138004
– Celso Marigo Jr