public static int getSumOfNumbers(String s) {
        /*
          Please implement this method to
          return the sum of all integers found in the parameter String. You can assume that
          integers are separated from other parts with one or more spaces (' ' symbol).
          For example, s="12 some text 3  7", result: 22 (12+3+7=22)
         */
        int result = 0;

        String decimalPattern = "(\\d{1,3})?(.)?(\\d{1,3})?";
        String integerPattern = "(\\d{1,3})";

        StringTokenizer st = new StringTokenizer(s);
        while (st.hasMoreTokens()) {
            String token = st.nextToken();

            if (token.contains(".")) {
                if (token.matches(decimalPattern)) {
                    result += Double.parseDouble(token);
                }
            } else {
                if (token.matches(integerPattern)) {
                    result += Integer.parseInt(token);
                }
            }
        }
        return result;
    }