code: public Range[] union(Range that){
          if(this.min>that.min)
              return that.union(this);
  
          // this -------------
          // that    --------------
          // that    -------
          if(contains(that.min))
              return new Range[]{ new Range(this.min, Math.max(this.max, that.max)) };
  
          // this -----------
          // that                --------------
          return new Range[]{ this, that };
      }
docs: returns union of this range with given range.<br>
  if both ranges are adjacent/intersecting to each other, then the
  returned array will have only one range. otherwise the returned array
  will have two ranges in sorted order.