how to read a csv file java

Java
FileReader from = new FileReader("data.txt");
Scanner source = new Scanner(from);
...
int count = source.nextInt();
String str = source.next();
String wholeLine = source.nextLine();
...
from.close();BufferedReader csvReader = new BufferedReader(new FileReader(pathToCsv));
while ((row = csvReader.readLine()) != null) {
    String[] data = row.split(",");
    // do something with the data
}
csvReader.close();
Source

Also in Java: