How would you go about skipping non-numeric characters in a string and only adding the sum of the numbers a multi line string?

I think I've made some progress. I can at least know which index values in my string are numbers. But I'm not sure how to actually get those values. I'm getting 199 for the sum, I'm really not sure where that is coming from since my indexes that are numbers are only 4,10,16 and 20.

String test = "Word1 Word2 Word3\nW 1";
          Scanner scan = new Scanner(test);
          int sum = 0;
            for(int i = 0;i<test.length();i++){
                    sum += test.charAt(i);
            System.out.println("sum = "+sum);

Nevermind. I got it. I guess I wasn't quite on the right track.