Cómo determinar los valores máximos y mínimos leídos desde un archivo de texto en Java

Estoy haciendo una tarea para una clase y estoy buscando algunos consejos útiles, no soluciones completas. Básicamente, tengo que escribir un programa Java que lee un archivo de texto y enumera la información línea por línea, enumera el número de línea y, finalmente, imprime el valor máximo y mínimo y los años que se relacionan con cada uno. El archivo de texto contiene un año y la temperatura para ese año. Por lo tanto, enumera algo así como "1900 50.9". No estoy destinado a usar una matriz, o el escáner, esto es parte de la asignación. Ya he logrado que el programa se imprima con éxito cada año y la temperatura correspondiente línea por línea con el recuento de líneas. Me dijeron que lo hiciera, y usé el bucle while. Ahora, mi único problema es acceder al archivo de texto de una manera que puedo distinguir de alguna manera de todas las temperaturas, cuál es la máxima y la mínima, y ​​en qué año ocurrió cada una. No he buscado ayuda hasta ahora porque quería poder resolverlo por mi cuenta, pero la tarea ya no vale ningún crédito debido a multas por demora. Cualquier ayuda sería realmente apreciada, ya que todavía quiero resolver esto. Gracias.

Esto es lo que tengo.

public class main {

/**
 * @param args the command line arguments
 */

public static void main(String[] args) throws Exception {


File temps = new File ("temps.txt"); //Creates path to temps.txt file
FileReader textReader = new FileReader (temps); //Input information from temps.txt file into file reader
BufferedReader kb = new BufferedReader (textReader); //Use buffered reader to hold temps.txt file info from the file reader




String tempList; //Create string variable named tempList
int lineCount = 0; //Create integer variable named lineCount
String sep = ": Temp "; //Create string variable named sep (short for separation) and set it equal to the literal string ":"
String space = " "; //Create string variable named space and set it equal to an actual space between texts


System.out.println("The following is the provided information from the file input. ");
while ((tempList = kb.readLine()) !=null) { //while loop stating that as long as the text file still has values to read (is not null), continue to execute


    System.out.println("Line " + lineCount++ + ": Year " + tempList.replace(space, sep)); //Prints out the line number (lineCount++), the info from the temps.txt file with a ":" between the year and the number (tempList.replace (space,sep)

}




}

}

La salida hasta ahora es esta:

Line 0: Year 1900: Temp 50.9
Line 1: Year 1901: Temp 49
Line 2: Year 1902: Temp 49.7
Line 3: Year 1903: Temp 49.5
Line 4: Year 1904: Temp 47.1
Line 5: Year 1905: Temp 49.1

Etc. todo el camino hasta ...

Line 99: Year 1999: Temp 52.7
BUILD SUCCESSFUL (total time: 0 seconds)

Respuestas a la pregunta(3)

Su respuesta a la pregunta