private static void check(int[] startOffsets, int[] endOffsets) {
      if (startOffsets.length != endOffsets.length) {
        throw new IllegalArgumentException("startOffsets and endOffsets must have the same length");
      }
    }
private static void check(int[] startOffsets, int[] endOffsets)