I am making an android app that reads in CSV files that contain values for the amount of people in parks. My aim is to make an app that outputs statistical analysis of the data such as means, modes and charts. My problem is I am unsure of how to store the data in java. There could be any number of rows but there will always be 72 columns. As you can see from below I used a simple array but this obviously doesn't work and only stores the last observation. I was thinking maps but unsure how to implement it. Any help is very much appreciated.
package messy;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Playing
{
static String[] tokens;
public static void main(String[] args)
{
//Input file which needs to be parsed
String fileToParse = "C:/Users/acer/Desktop/soparc shit/SOPARC.csv";
BufferedReader fileReader = null;
//Delimiter used in CSV file
final String DELIMITER = ",";
try
{
String line = "";
//Create the file reader
fileReader = new BufferedReader(new FileReader(fileToParse));
fileReader.readLine();
//Read the file line by line
while ((line = fileReader.readLine()) != null)
{
//Get all tokens available in line
tokens = line.split(DELIMITER);
}
}
catch (Exception e) {
e.printStackTrace();
}
finally
{
try {
fileReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
List<String[]>, for example an ArrayList.