threeBiggest[i] = new Repetition(-1, 1);
threeBiggest[i] = new Repetition(4);  int pos = 0;  while (pos<nodes.length) {  int ahead=1; do { while (ahead <= MAX_LOOKAHEAD && pos+ahead < nodes.length && !nodes[pos].equals(nodes[pos+ahead])) { ahead++; }   int reps = 0; if (ahead <= MAX_LOOKAHEAD && pos+ahead < nodes.length && nodes[pos].equals(nodes[pos+ahead])) {  do { int i; for (i=pos+reps*ahead; i<pos+(reps+1)*ahead; i++) {  if (i+ahead >= nodes.length) { break; } if (!nodes[i].equals(nodes[i+ahead])) { break; } }  if (i==pos+(reps+1)*ahead) { reps++; } else { break; } } while (true); }    if (reps <= 1) {   if (ahead >= MAX_LOOKAHEAD) { pos++; } } else {    reps++;     addToThreeBiggest(threeBiggest, pos + 1, reps, ahead);  pos += reps*ahead;  break; }  ahead++; } while (ahead<=MAX_LOOKAHEAD); }
    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;    }