public static MatchData fromRegion(@Nullable Region matchedRegion) {
    if (matchedRegion != null) {
      int[] offsets = new int[matchedRegion.getNumRegs() * 2];
      for (int i = 0; i < matchedRegion.getNumRegs(); i++) {
        int startIndex = i * 2;
        offsets[startIndex] = Math.max(matchedRegion.getBeg(i), 0);
        offsets[startIndex + 1] = Math.max(matchedRegion.getEnd(i), 0);
      }
      return new MatchData(true, offsets);
    }
    return NOT_MATCHED;
  }
public static MatchData fromRegion(@Nullable Region matchedRegion)