int[] array = new int[3];
array[0] = 3;
array[1] = 2;
array[2] = 4;
for(int i = 0 ; i < array.length;i++){
for(int j = i+1 ; j< array.length;j++){
if(array[i] < array[j]){
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
for(int i=0; i<array.length; i++) {
System.out.println(array[i]);
}
So for example in this I have the code printing out the array values from highest to lowest(4,3,2). However what I would like it to do is print the index/position of the array instead(2,0,1). Can't quite seem to figure it out myself, fairly new to this.