code: private int[] allMatcherGroupsToIntArray(Matcher matcher) {
          int numGroups = matcher.groupCount();
          int[] digits = new int[numGroups];
          for (int i = 0; i < numGroups; i++) {
              digits[i] = Integer.parseInt(matcher.group(i + 1));
          }
          return digits;
      }
docs: Takes groups 1 to n of a matcher with groupCount() == n
  and places them in order into an int[] array of size n.
  
  @param matcher
  @return