title: Reading the values for the graph from text file?
body: <p>I have a program which will take values from array.</p>
  
  <pre><code> int graph[][] = new int[][] {{0, 2, 0, 6, 0},
                                  {2, 0, 3, 8, 5},
                                  {0, 3, 0, 0, 7},
                                  {6, 8, 0, 0, 9},
                                  {0, 5, 7, 9, 0},
                                 };
  </code></pre>
  
  <p>I have tried changing the inline input to text file input but i am getting type mismatch errors.</p>
  
  <pre><code>Scanner inFile = new Scanner(new File("split_this.txt"));
  String s = inFile.nextLine();
  int numberOfVertices = Integer.parseInt(s);
  while (inFile.hasNext()) {
      s = inFile.nextLine();
      String[] triplet = s.split("[\\|]");
      String[][] tokens = new String[ triplet.length ][];
      for (int i = 0; i &lt; triplet.length; i++){
          tokens[i] = triplet[i].split("[,]");
      }
      for (int z = 0; z &lt; tokens.length; z++){
           for (int i = 0; i &lt; tokens[z].length; i++){
              int graph[][] = tokens[z][i];
           }
      }
  }
  </code></pre>
  
  <p>Please help me.</p>