I have a text file with 12 columns. Each column has a title and then a float or a string in the column, for example
A B time
-0.042 centre 00:00:03
Each column is separated by a space. I would like to compute the average of the numbers in each column. Later on I will compute the average of the columns for certain time intervals and compare it to the overall average. So I figured it might be easiest to put all the elements in an array and call this array the title of the column. I am unsure of how to make several arrays or lists, one for each column and how to skip a column if it only has strings. I'm using a try catch for the text file. Here is what I have for my try so far:
try {
FileReader fileReader = new FileReader(fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
ArrayList<Integer> lines = new ArrayList<Integer>();
Float columns = 12;
while((num_line = bufferedReader.readLine()) != null) {
lines.add(Float.valueOf(line.split(" ")[columns-1]));
}
for(int l:lines){
sum+=l;
}
float average = (float)sum/lines.size();
bufferedReader.close();
}