title: Compute data from a specific csv column in java
body: <p>I know that this kind of question has already been treated on this forum, but I didn't find the correct answer I liked. I have a csv file with 2 columns, I'd like to compute the sum the the second column (value column) of my file. These are my csv file and my code example :
  file.csv</p>
  
  <pre><code>## Date ##     ## Value##
  Status OK
  12/12/2014          2
  13/12/2014          5
  14/12/2014          0
  15/12/2014          3
  Status KO
  16/12/2014          5
  17/12/2014          0
  17/12/2014          7
  17/12/2014          1
  </code></pre>
  
  <p>This class display just the column without the header (value). I like to make the sum of these elemnts (2+5+0+3+5+0+7+1)</p>
  
  <pre><code>public class LectureCSV {
  
  public static void main(String[] args) {
      try {
          String csvFile = "C:/Users/Downloads/file.csv";
  
          @SuppressWarnings("resource")
          CSVReader csvReader = new CSVReader(new FileReader(csvFile), ';');
          String[] col;
          while ((col = csvReader.readNext()) != null) {
              if (!col[1].startsWith("valeur")) {
                  System.out.println(col[1]);
              }
  
          }
  
      } catch (IOException ex) {
          Logger.getLogger(LectureCSV.class.getName()).log(Level.SEVERE,
                  null, ex);
      }
  }
  </code></pre>
  
  <p>}</p>