LongRangeSet (@NotNull LongRangeSet startSet, @NotNull LongRangeSet lengthSet) { long maxLeftBorder = startSet.max(); LongRangeSet lengthMinusOne = lengthSet.minus(LongRangeSet.point(1), LongRangeType.INT32); long minRightBorder = startSet.plus(lengthMinusOne, LongRangeType.INT32).min(); if (maxLeftBorder > minRightBorder) return LongRangeSet.empty(); return LongRangeSet.range(maxLeftBorder, minRightBorder); }