public Rectangle union (Rectangle r)

Computes the union of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the union of the two rectangles.

If either Rectangle has any dimension less than zero the rules for non-existant rectangles apply. If only one has a dimension less than zero, then the result will be a copy of the other Rectangle. If both have dimension less than zero, then the result will have at least one dimension less than zero.

If the resulting Rectangle would have a dimension too large to be expressed as an int, the result will have a dimension of Integer.MAX_VALUE along that dimension.

Parameters:
r    the specified Rectangle

Returns:  the smallest Rectangle containing both the specified Rectangle and this Rectangle.