Prototype: parseValue(String text) -> long strip()-parses a signed decimal long. Blank/malformed/out-of-range text raises IllegalArgumentException with the original NumberFormatException as its cause. Negative numbers are valid. Null outside domain.

Final: total(Reader reader) -> long throws IOException takes ownership and closes the reader exactly once on success and every failure. Process lines, skip strip()-empty lines, parse the others using parseValue, and sum with Math.addExact (overflow raises ArithmeticException). Empty input totals zero. Propagate IOException. A body error remains primary if close also fails, with close error suppressed. No whole-file materialization.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.

Java runs on this device with CheerpJ 4.3.