public static void main(String[] args) throws IOException {
        LineNumberReader lineNumberReader = new LineNumberReader(
                new InputStreamReader(System.in, StreamUtil.DEFAULT_CHARSET));

        String line;
        long total = 0;

        while ((line = lineNumberReader.readLine()) != null) {
            total += Long.parseLong(line);
        }

        System.out.println(total);

    }
Utility to sum lines in a file
stroom-util/src/main/java/stroom/util/io/LineSum.java