There are a few of these topics out there, but this problem has a slight twist that makes it different.
I\'m focused on only half of a larger problem. I\'m sure man
With Java 8 and it's Streams:
static public int[][] create2DIntMatrixFromFile(Path path) throws IOException {
return Files.lines(path)
.map((l)->l.trim().split("\\s+"))
.map((sa)->Stream.of(sa).mapToInt(Integer::parseInt).toArray())
.toArray(int[][]::new);
}
This is just for the 'reading' part of the question.