I was trying to make a website that uses a java program to read weather information from a file and then creates a web page.

Below is my entire code:

import java.io.*;
import java.util.Scanner;

public class P1 {

float max, min;

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

// Open the file
// FileInputStream fstream = new FileInputStream("weather-short.csv");
//
// // Get the object of DataInputStream
// DataInputStream in = new DataInputStream(fstream);
// BufferedReader br = new BufferedReader(new InputStreamReader(in));
//
// String strLine;
// {
// // Read File Line By Line
// while ((strLine = br.readLine()) != null) {
// // Print the content on the console
// System.out.println(strLine);
// }
//
// // Close the input stream
// in.close();
//
// }

String input = readTextFile("");
System.out.println(input);
writeTextFile("", input);
String source = read("");
output(source);
split(input);
compare(input);
}

// Reading contents from the file

public static String readTextFile(String fileName) {
String Value = "";
FileReader file;
String line = "";
try {
file = new FileReader("weather-short.csv");
BufferedReader reader = new BufferedReader(file);
while ((line = reader.readLine()) != null) {
Value += line + "\n";
}

} catch (FileNotFoundException e) {
throw new RuntimeException("File not found");
} catch (IOException e) {
throw new RuntimeException("IO Error occured");
}
return Value;

}

// Writing contents to the new file

public static void writeTextFile(String fileName, String s) {
FileWriter output;
try {
output = new FileWriter("newfile.csv");
BufferedWriter writer = new BufferedWriter(output);
writer.write(s);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}

}

// Reading the Source.html file of Hello World

public static String read(String filename) {
String l = "";
String V = "";
try {
FileReader fn = new FileReader("Source.html");
BufferedReader reader = new BufferedReader(fn);
while ((l = reader.readLine()) != null) {
V += l + "\n";
}
} catch (FileNotFoundException e) {
throw new RuntimeException("File not found");
} catch (IOException e) {
throw new RuntimeException("IO Error occured");
}
return V;

}

// Writing to a new html file that contains the weather data

public static void output(String V) {
try {
FileWriter fstream = new FileWriter("out.html");
BufferedWriter out = new BufferedWriter(fstream);
out.write(V);
out.close();
} catch (IOException e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
}

public static void split(String file) {
Scanner S1 = new Scanner(file);
S1.useDelimiter(",");
while (S1.hasNext()) {
System.out.print(S1.next());
System.out.println();

}

}
public static void compare(String F) {
for (int i = 0; i < F.length(); i++) {




}
}
}
}


The problems i am having are:
1. I need to keep track of the maximum and minimum temperature in the weather-short.csv file and compare it with the max or min global variables in the compare method, what is the way to do it?
2. How should I then link this code in the html file?