private static boolean segmentsEqual(@NotNull SegmentArrayWithData a1,
                                       int idx1,
                                       @NotNull SegmentArrayWithData a2,
                                       int idx2,
                                       int offsetShift) {
    return a1.getSegmentStart(idx1) + offsetShift == a2.getSegmentStart(idx2) &&
           a1.getSegmentEnd(idx1) + offsetShift == a2.getSegmentEnd(idx2) &&
           a1.getSegmentData(idx1) == a2.getSegmentData(idx2);
  }
private static boolean segmentsEqual(@NotNull SegmentArrayWithData a1,
                                       int idx1,
                                       @NotNull SegmentArrayWithData a2,
                                       int idx2,
                                       int offsetShift)