class INNNumberFilter extends RuleFilter {

  private static final Pattern DIGIT_SYMBOL_PATTERN = Pattern.compile("(\\d*)");


  @Override
  public RuleMatch acceptRuleMatch(RuleMatch match, Map<String, String> args, int patternTokenPos, AnalyzedTokenReadings[] patternTokens, List<Integer> tokenPositions) {<FILL_FUNCTION_BODY>}
}


  String INNNumberString = getRequired("inn", args);

    Matcher matcherdigitsymbol = DIGIT_SYMBOL_PATTERN.matcher(INNNumberString);

      try {
          if (matcherdigitsymbol.matches()) {

              int[] intTab = String.valueOf(INNNumberString).chars().map(Character::getNumericValue).toArray();
              int kz1=0;
              int kz2=0;
              switch (intTab.length) {
                  case 10:
                      kz1 = (intTab[0]*2 + intTab[1]*4 + intTab[2]*10 + intTab[3]*3 + intTab[4]*5+ intTab[5]*9 + intTab[6]*4 + intTab[7]*6 + intTab[8]*8)%11;
                      if (kz1>9) {kz1=kz1-10;};
                      if (intTab[9] == kz1)  {
                          return null;
                      } else {
                          return match;
                      }
                  case 12:
                      kz1 = (intTab[0]*7 + intTab[1]*2 + intTab[2]*4 + intTab[3]*10 + intTab[4]*3 + intTab[5]*5+ intTab[6]*9 + intTab[7]*4 + intTab[8]*6 + intTab[9]*8)%11;
                      kz2 = (intTab[0]*3 + intTab[1]*7 + intTab[2]*2 + intTab[3]*4 + intTab[4]*10 + intTab[5]*3 + intTab[6]*5+ intTab[7]*9 + intTab[8]*4 + intTab[9]*6 + intTab[10]*8)%11;
                      if (kz1>9) {kz1=kz1-10;};
                      if (kz2>9) {kz2=kz2-10;};
                      
                      if ((intTab[10] == kz1) && (intTab[11] == kz2)) {
                          return null;
                      } else {
                          return match;
                      }
                  default:
                      return null;
              }

          } else {
              return null;
      }
    } catch (IllegalArgumentException ignore) {
      // happens with 'inn' like '7676gj8778' - those should be caught by a different rule
      return null;
    }
  
<methods>public non-sealed void <init>() ,public abstract org.languagetool.rules.RuleMatch acceptRuleMatch(org.languagetool.rules.RuleMatch, Map<java.lang.String,java.lang.String>, int, org.languagetool.AnalyzedTokenReadings[], List<java.lang.Integer>) throws java.io.IOException,public boolean matches(Map<java.lang.String,java.lang.String>, org.languagetool.AnalyzedTokenReadings[], int, List<java.lang.Integer>) throws java.io.IOException<variables>