java - Sorting arrays descending -


i've learned how sort arrays in ascending order code in java;

int swapindex,temp;  for(int index=0; index<=array.length-2; index++) {      swapindex = index;      for(int i=index+1; i<=array.length-1; i++)         if(array[i]<array[swapindex]) swapindex = i;      temp = array[index]; array[index] = array[swapindex];      array[swapindex] = temp;    }  } 

can please tell me how can use code sort in descending order? best regards

why don't use instead?

arrays.sort(array, collections.reverseorder()); 

Comments

Popular posts from this blog

c - CUDA code not processing if block properly -

oracle11g - get root domain from url Oracle sql regex_substr -

xcode - Swift Playground - Files are not readable -