### Question:
CIDR { public boolean overlaps(CIDR cidr) { return (start <= cidr.start && cidr.start <= end) || (start <= cidr.end && cidr.end <= end) || (cidr.start <= start && start <= cidr.end) || (cidr.start <= end && end <= cidr.end); } CIDR();  CIDR(CIDR cidr);  CIDR(long start, long end, int mask);  CIDR(String input); boolean overlaps(CIDR cidr); String getText(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); long getStart(); void setStart(long start); long getEnd(); void setEnd(long end); int getMask(); void setMask(int mask); static final long MAX_IP; }### Answer:
@Test public void testOverlaps() { CIDR cidr1; CIDR cidr2; cidr1 = new CIDR("0.0.0.0/0"); cidr2 = new CIDR("1.2.3.4/32"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("1.2.3.4/32"); cidr2 = new CIDR("1.2.3.4/32"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("1.2.3.4/32"); cidr2 = new CIDR("0.0.0.0/0"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("255.255.255.255/32"); cidr2 = new CIDR("0.0.0.0/0"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("1.0.0.0/32"); cidr2 = new CIDR("1.0.0.0/8"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("1.255.255.255/32"); cidr2 = new CIDR("1.0.0.0/8"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("0.255.255.255/32"); cidr2 = new CIDR("1.0.0.0/8"); assertFalse(cidr1.overlaps(cidr2)); assertFalse(cidr2.overlaps(cidr1)); cidr1 = new CIDR("2.0.0.0/32"); cidr2 = new CIDR("1.0.0.0/8"); assertFalse(cidr1.overlaps(cidr2)); assertFalse(cidr2.overlaps(cidr1)); cidr1 = new CIDR("1.1.0.0/16"); cidr2 = new CIDR("1.0.0.0/8"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("1.1.24.0/24"); cidr2 = new CIDR("1.0.0.0/8"); assertTrue(cidr1.overlaps(cidr2)); assertTrue(cidr2.overlaps(cidr1)); cidr1 = new CIDR("3.0.0.0/24"); cidr2 = new CIDR("1.0.0.0/8"); assertFalse(cidr1.overlaps(cidr2)); assertFalse(cidr2.overlaps(cidr1)); }