### Question:
Rect { public Rect intersect(Rect other) { if (!intersects(other)) { return null; } int l = left > other.left ? left : other.left; int t = top > other.top ? top : other.top; int r = right < other.right ? right : other.right; int b = bottom < other.bottom ? bottom : other.bottom; return new Rect(l, t, r, b); } Rect(int left, int top, int right, int bottom);  Rect(int left, int top, Dimension size); int width(); int height(); Dimension size(); int area(); Rect scale(double scx, double scy); boolean intersects(Rect other); Rect intersect(Rect other); Envelope envelope(); Rect map(Envelope bbox, Envelope other); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); final int left; }### Answer:
@Test public void testIntersect() { Rect r = new Rect(0,0,10,10); Rect i = r.intersect(new Rect(-5,5,5,15)); System.out.println(i); }