public static long union(long range1, long range2) {
    if (range1 == range2) return range1;
    int start = Math.min(startOffset(range1), startOffset(range2));
    int end = Math.max(endOffset(range1), endOffset(range2));
    return toScalarRange(start, end);
  }
public static long union(long range1, long range2)