title: Reading 2-D array from a file
body: <p>I have a 2-D int array in file 'array.txt'. I am trying to read all the elements in the file in a two dimensional array. I am having problem in copying. It shows all the elements having value '0' after copying instead their original value. Please help me.
  My code is : </p>
  
  <pre><code>import java.util.*;
  import java.lang.*;
  import java.io.*;
  
  public class appMainNineSix {
  
      /**
       * @param args
       */
      public static void main(String[] args) 
          throws java.io.FileNotFoundException{
          // TODO Auto-generated method stub
          Scanner input = new Scanner (new File("src/array.txt"));
          int m = 3;
          int n = 5;
          int[][] a = new int [m][n];
          while (input.next()!=null){
              for (int i=0;i&lt;m;i++){
                  for (int j=0;j&lt;n;j++)
                      a[i][j]= input.nextInt();
              }   
  
          }
          //print the input matrix
          System.out.println("The input sorted matrix is : ");
          for(int i=0;i&lt;m;i++){
              for(int j=0;j&lt;n;j++)
                  System.out.println(a[i][j]);
          }
  
      }
  
  }
  </code></pre>