code: private int matchesDigit(String str, int start, int[] decVal) {
          String[] localeDigits = symbols.getDigitStringsLocal();
  
          // Check if the sequence at the current position matches locale digits.
          for (int i = 0; i < 10; i++) {
              int digitStrLen = localeDigits[i].length();
              if (str.regionMatches(start, localeDigits[i], 0, digitStrLen)) {
                  decVal[0] = i;
                  return digitStrLen;
              }
          }
  
          // If no locale digit match, then check if this is a Unicode digit
          int cp = str.codePointAt(start);
          decVal[0] = UCharacter.digit(cp, 10);
          if (decVal[0] >= 0) {
              return Character.charCount(cp);
          }
  
          return 0;
      }
docs: Check if the substring at the specified position matches a decimal digit.
  If matched, this method sets the decimal value to <code>decVal</code> and
  returns matched length.
  
  @param str       The input string
  @param start     The start index
  @param decVal    Receives decimal value
  @return          Length of match, or 0 if the sequence at the position is not
  a decimal digit.