How can I open a .txt file and read numbers separated by enters or spaces into an array list?
Good news in Java 8 we can do it in one line:
List ints = Files.lines(Paths.get(fileName)) .map(Integer::parseInt) .collect(Collectors.toList());