private static String createAverageList(int n,String currentPuzzle,String currentPuzzleSubtype,DatabaseHandler dbHandler){
  int average;
  ArrayList<Integer> aoList=dbHandler.getListOfTruncatedAverageOf(n,currentPuzzle,currentPuzzleSubtype,true);
  average=aoList.get(n);
  aoList.remove(n);
  int best=Integer.MAX_VALUE;
  for (  int time : aoList) {
    if (time != -1 && time < best)     best=time;
  }
  if (best == Integer.MAX_VALUE)   best=-1;
  int worst;
  if (aoList.contains(-1))   worst=-1;
 else   worst=Collections.max(aoList);
  Collections.reverse(aoList);
  StringBuilder aoStringList=new StringBuilder(convertTimeToString(average) + " = ");
  boolean markedMax=false;
  boolean markedMin=false;
  for (  int time : aoList) {
    if (time == worst && !markedMax) {
      aoStringList.append("(");
      aoStringList.append(convertTimeToString(time));
      aoStringList.append("), ");
      markedMax=true;
    }
 else     if (time == best && !markedMin) {
      aoStringList.append("(");
      aoStringList.append(convertTimeToString(time));
      aoStringList.append("), ");
      markedMin=true;
    }
 else {
      aoStringList.append(convertTimeToString(time));
      aoStringList.append(", ");
    }
  }
  return aoStringList.substring(0,aoStringList.length() - 2);
}

private static String createAverageList ( int n , String currentPuzzle , String currentPuzzleSubtype , DatabaseHandler dbHandler ) { int average ; ArrayList < Integer > aoList = dbHandler . getListOfTruncatedAverageOf ( n , currentPuzzle , currentPuzzleSubtype , true ) ; average = aoList . get ( n ) ; aoList . remove ( n ) ; int best = Integer . MAX_VALUE ; for ( int time : aoList ) { if ( time != - 1 && time < best ) best = time ; } if ( best == Integer . MAX_VALUE ) best = - 1 ; int worst ; if ( aoList . contains ( - 1 ) ) worst = - 1 ; else worst = Collections . max ( aoList ) ; Collections . reverse ( aoList ) ; StringBuilder aoStringList = new StringBuilder ( convertTimeToString ( average ) + " = " ) ; boolean markedMax = false ; boolean markedMin = false ; for ( int time : aoList ) { if ( time == worst && ! markedMax ) { aoStringList . append ( "(" ) ; aoStringList . append ( convertTimeToString ( time ) ) ; aoStringList . append ( "), " ) ; markedMax = true ; } else if ( time == best && ! markedMin ) { aoStringList . append ( "(" ) ; aoStringList . append ( convertTimeToString ( time ) ) ; aoStringList . append ( "), " ) ; markedMin = true ; } else { aoStringList . append ( convertTimeToString ( time ) ) ; aoStringList . append ( ", " ) ; } } return aoStringList . substring ( 0 , aoStringList . length ( ) - 2 ) ; }
creates a list of averages from a number . useful for sharing
