### Question:
Range implements Serializable { public static Range shift(Range base, double delta) { return shift(base, delta, false); } Range(double lower, double upper); double getLowerBound(); double getUpperBound(); double getLength(); double getCentralValue(); boolean contains(double value); boolean intersects(double b0, double b1); boolean intersects(Range range); double constrain(double value); static Range combine(Range range1, Range range2); static Range combineIgnoringNaN(Range range1, Range range2); static Range expandToInclude(Range range, double value); static Range expand(Range range,
                               double lowerMargin, double upperMargin); static Range shift(Range base, double delta); static Range shift(Range base, double delta,
                              boolean allowZeroCrossing); static Range scale(Range base, double factor); @Override boolean equals(Object obj); boolean isNaNRange(); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testShift() { Range r1 = new Range(10.0, 20.0); Range r2 = Range.shift(r1, 20.0); assertEquals(30.0, r2.getLowerBound(), 0.001); assertEquals(40.0, r2.getUpperBound(), 0.001); r1 = new Range(0.0, 100.0); r2 = Range.shift(r1, -50.0, true); assertEquals(-50.0, r2.getLowerBound(), 0.001); assertEquals(50.0, r2.getUpperBound(), 0.001); r1 = new Range(-10.0, 20.0); r2 = Range.shift(r1, 20.0, true); assertEquals(10.0, r2.getLowerBound(), 0.001); assertEquals(40.0, r2.getUpperBound(), 0.001); r1 = new Range(-10.0, 20.0); r2 = Range.shift(r1, -30.0, true); assertEquals(-40.0, r2.getLowerBound(), 0.001); assertEquals(-10.0, r2.getUpperBound(), 0.001); r1 = new Range(-10.0, 20.0); r2 = Range.shift(r1, 20.0, false); assertEquals(0.0, r2.getLowerBound(), 0.001); assertEquals(40.0, r2.getUpperBound(), 0.001); r1 = new Range(-10.0, 20.0); r2 = Range.shift(r1, -30.0, false); assertEquals(-40.0, r2.getLowerBound(), 0.001); assertEquals(0.0, r2.getUpperBound(), 0.001); r2 = Range.shift(r1, 0.0); assertEquals(r1, r2); try { Range.shift(null, 0.1); fail("Null value is accepted"); } catch (Exception e) { } }