java intercambiar la posicion de valores de un array
public class ArrayMethods {
private int[] values;
public ArrayMethods(int[] initialValues) {
values = initialValues;
}
public void swapFirstAndLast() {
int lastvalplace = values.length;
int firstval = values[0];
values[0] = values[lastvalplace];
values[lastvalplace] = firstval;
}
public static void main(String[] args) {
ArrayMethods initialValues = new ArrayMethods(int[] 50, 32, 4, 9, 2);
swapFirstAndLast = new swapFirstAndLast(values);
}
}