Can anybody please help me with reading a graph data from a file and save the data into a java 2D array or List? I have been struggling
Here is the code I have so far:
Scanner matrix = new Scanner(new File("graph_input.txt"));
String[][] arr = new String[8][];
while(matrix.hasNextLine()){
String[] data = matrix.nextLine().split("\\s+");
for (int i = 0; i < arr.length; i++){
for (int j = 0; j < arr[i].length; j++){
arr[i][j] = Arrays.toString(arr[j]);
}
}
}
Thank you very much for any help you can provide.
