String last = "";  int repetitions = 1;  int counter = 0;  int line = 1; String current;  while (t.hasMoreTokens()) {  current = t.nextToken(); counter++; if (last.equals(current) &&  repetitions < MAX_REP) { repetitions++; } else {  addToThreeBiggest(threeBiggest, line, repetitions); repetitions = 1; last = current; line = counter; } }  addToThreeBiggest(threeBiggest, line, repetitions);
    private static Repetition[] threeBiggestRepetitions(String str) {	StringTokenizer t = new StringTokenizer(str, "\n");	Repetition[] threeBiggest = new Repetition[3];	//force the repetition count to be > 1	for (int i = 0; i < 3; i++) 	    threeBiggest[i] = new Repetition(-1, 1);		String last = "";	//the current number of repetitions for the sequence	int repetitions = 1;	//the total lines seen so far	int counter = 0;	//the starting line of the sequence we are currently at	int line = 1;	String current;		while (t.hasMoreTokens()) {	    //get the next route instruction	    current = t.nextToken();	    counter++;	    if (last.equals(current) &&  repetitions < MAX_REP) {		repetitions++;	    }	    else {		//see if the repetition count is larger than any of the previous                addToThreeBiggest(threeBiggest, line, repetitions);		repetitions = 1;		last = current;		line = counter;	    }	}	//see if the repetition count is larger for the last sequence        addToThreeBiggest(threeBiggest, line, repetitions);	return threeBiggest;    }