dimanche 1 mars 2015

I'm trying to read a csv file to a 2D array in Java.


So far I manage to follow some stackoverflow examples and successfully read the .csv using opencsv-3.2.



CSVReader csvReader = new CSVReader(new FileReader(new File("file.txt")));
List<String[]> list = csvReader.readAll();

String[][] dataArr = new String[list.size()][];
dataArr = list.toArray(dataArr);


However I would like to dataArr be on float type and not on String. I probably imagine that we have to convert the String list to float, but despite several attempts and some reading I still do not have success. Thanks


Aucun commentaire:

Enregistrer un commentaire