Ex ficheiro:
1 2 3
4 5 6
private static int[][] matrizFicheiro() {
File file = new File(filename);
Scanner myReader = new Scanner(file);
String line = myReader.nextLine();
int lineNumber = 0;
int [][] a = new int[lineNumber][];
while(myReader.hasNextLine()){
lineNumber++;
for(int i = 0; i < a.length; i++){
for(int j = 0; j < a[i].length; j++){
a[i][j] = myReader.nextInt();
}
}
}
myReader.close();
return a;
}