I have an example of my idea in a 1d array. It will only output the columns. My idea is to use a 2d array to select the row and column. Here my code:
String
I would use a dynamic structure to read all lines. Also you should use a try-resource block to close the streams automatically.
public static String[][] readCSV(String path) throws FileNotFoundException, IOException {
try (FileReader fr = new FileReader(path);
BufferedReader br = new BufferedReader(fr)) {
Collection lines = new ArrayList<>();
for (String line = br.readLine(); line != null; line = br.readLine()) {
lines.add(line.split(";"));
}
return lines.toArray(new String[lines.size()][]);
}
}