read 7 columns from .csv file in java?
<p>Iam new to java can anybody suggest me how to read csv file 7 columns which i need to use in my program in java?</p>

<p>I wrote a program to read a .csv file from my laptop but i need to read only 7 columns from .csv file. can anybody suggest me how to do?
    Here is my code:</p>

<pre><code>import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class main {
 public static  Map&lt;String,String&gt; map1 = null;
 public static  Map&lt;String,String&gt; map2 = null;
  public static void main(String[] args) {
      try
      {
          readFileandPopulate();
          for (Map.Entry&lt;String, String&gt; entry : map1.entrySet()) {
                System.out.println("Key : " + entry.getKey() + " Value : "
                    + entry.getValue()+" address :"+map2.get(entry.getKey()));
                //insert into DB
            }
            }catch (Exception e){//Catch exception if any
                e.printStackTrace();
          System.err.println("Error: " + e.getMessage());
          }
  }
  public static void readFileandPopulate() throws Exception
  {
      FileInputStream fstream = new FileInputStream("/Users/Desktop/Pattern Recognition/DataSetR/1a19.csv");
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));
      String strLine;
      map1 = new HashMap&lt;String,String&gt;();
          while ((strLine = br.readLine()) != null)   {
              System.out.println(strLine);
          String temp[] = strLine.split(",");
          map1.put(temp[0], temp[1]);
      }
     in.close();
     System.out.println("done 1");

  }
} 
</code></pre>

<p>Is there any method to just read few columns and delete remaining data or can i store all values in array and use index of array to calculate one equation using values.</p>
