Advertisement
SchrodZzz

Untitled

Dec 12th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. public class Sum {
  2.     public static void main(String[] args) {
  3.         int result = 0;
  4.         for (String currentString : args) {
  5.             for (String currentDigit : currentString.split("[^0-9.-]")) {
  6.                 if (!currentDigit.isEmpty()) {
  7.                     result += Integer.parseInt(currentDigit);
  8.                 }
  9.             }
  10.         }
  11.         System.out.println(result);
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement