code: private void sortCandidateList(ArrayList list) {
      java.util.Collections.sort(list, new java.util.Comparator() {
        public int compare(Object o1, Object o2) {
          // First sort, by score in index
          double scoreT = ( (Candidates) o1).getScore(),
              scoreU = ( (Candidates) o2).getScore();
          if (scoreU > scoreT) {
            return 1;
          }
          if (scoreU < scoreT) {
            return -1;
          }
          return 0;
        }
      }
      );
    }
docs: sortCandidateList sort a list of candidate pair of tokens.
  
  @param tokenArray String[]
  @return float[]