public static void sort(AbstractList array,int[] indices){
  for (int i=0; i < indices.length; i++) {
    indices[i]=i;
  }
  int temp;
  int j, n=array.size();
  for (j=n / 2; j > 0; j--) {
    adjust(array,indices,j,n);
  }
  for (j=n - 1; j > 0; j--) {
    temp=indices[0];
    indices[0]=indices[j];
    indices[j]=temp;
    adjust(array,indices,1,j);
  }
}

public static void sort ( AbstractList array , int [ ] indices ) { for ( int i = 0 ; i < indices . length ; i ++ ) { indices [ i ] = i ; } int temp ; int j , n = array . size ( ) ; for ( j = n / 2 ; j > 0 ; j -- ) { adjust ( array , indices , j , n ) ; } for ( j = n - 1 ; j > 0 ; j -- ) { temp = indices [ 0 ] ; indices [ 0 ] = indices [ j ] ; indices [ j ] = temp ; adjust ( array , indices , 1 , j ) ; } }
sorts an array of indices to vector of comparable objects into increasing order .
