Get the first two numbers of a string
In fact, you can:

public static String getFirstTwoNumbersOfString2(String s) {
    StringBuilder sb = new StringBuilder(2); // Capacity of 2 chars.

    for (char c : s.toCharArray()) {
        if (Character.isDigit(c)) {
            sb.append(c);

            if (sb.length() == 2) {
                break;
            }
        }
    }

    return sb.toString();
}


Above you can nicely ask Character whether a given character is a digit. Also, StringBuilder.append runs in constant amortized time unlike string concatenation which will build a copy of two concatenated strings.

Hope that helps.