title: To print the sum of the numbers(not digits) in a string
body: <p>I was recently asked to write a function in java which will sum the numbers(not digits) in a string. e.g. if the string is abc35zz400tt15, the output should be 450.</p>
  
  <p>this is what i wrote :</p>
  
  <pre><code> public static void getSum(String a){
          String[] arr=a.split("(?&lt;=\\D)(?=\\d)|(?&lt;=\\d)(?=\\D)");
          int sum=0;
          for(int i=0;i&lt;arr.length;i++){
              if(Pattern.matches("[0-9]+", arr[i]))
          sum+=Integer.parseInt(arr[i]);
      }
      System.out.println(sum);
      }
  </code></pre>
  
  <p>Is there a more efficient way to do this as they didn't look satisfied with the above code.</p>