title: how to read a txt file containing matrix form of data into 2d array of same dimensions as in the file using java
body: <p>here is my code:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileReader;
  import java.io.IOException;
  import java.util.StringTokenizer;
  
  
  public class csvimport5 {
  
  
      public static void main(String[] args) throws IOException {
  
  
          double [][] data = new double [87][2];  
          File file = new File("buydata.txt");
          int row = 0;
          int col = 0;
          BufferedReader bufRdr  = new BufferedReader(new FileReader(file));
          String line = null;
  
  
          //read each line of text file
          while((line = bufRdr.readLine()) != null &amp;&amp; row &lt; data.length)
          {   
          StringTokenizer st = new StringTokenizer(line,",");
          while (st.hasMoreTokens())
          {
              //get next token and store it in the array
              data[row][col] = Double.parseDouble(st.nextToken());
              col++;
          }
          col = 0;
          row++;
          }
  
          System.out.println(" "+data[87][2]);  
  
        }
  
      }
  </code></pre>
  
  <p>it shows error:-numberformatException :empty string </p>
  
  <p>pls help me</p>