InterpolationLibrary { public static double interpolatePair(double fromValue, double toValue, double ratio) { return ratio * (toValue - fromValue) + fromValue; }  static double interpolate(
      SortedMap<K, V> values, K target); static double interpolate(
      SortedMap<K, V> values, K target, EOutOfRangeStrategy outOfRangeStrategy); static V nearestNeighbor(SortedMap<K, V> values,
      K target); static double interpolate(double[] keys, double[] values,
	      double target, EOutOfRangeStrategy outOfRangeStrategy); static double interpolate(double[] keys, double[] values,
      double target, EOutOfRangeStrategy outOfRangeStrategy, EInRangeStrategy inRangeStrategy); static double interpolatePair(double fromValue, double toValue,
      double ratio); static double interpolatePair(double keyA, double valueA, double keyB,
      double valueB, double targetKey); static VALUE interpolate(
      InterpolationStrategy<KEY, VALUE> interpolationStrategy,
      EOutOfRangeStrategy outOfRangeStrategy,
      SortedMap<ANY_KEY, ANY_VALUE> values, ANY_KEY target);  }
@Test public void testInterpolatePair() { assertEquals(10.5, interpolatePair(0.0, 10.0, 4.0, 8.0, -1.0), 0.0); assertEquals(10.0, interpolatePair(0.0, 10.0, 4.0, 8.0, 0.0), 0.0); assertEquals(9.5, interpolatePair(0.0, 10.0, 4.0, 8.0, 1.0), 0.0); assertEquals(9.0, interpolatePair(0.0, 10.0, 4.0, 8.0, 2.0), 0.0); assertEquals(8.5, interpolatePair(0.0, 10.0, 4.0, 8.0, 3.0), 0.0); assertEquals(8.0, interpolatePair(0.0, 10.0, 4.0, 8.0, 4.0), 0.0); assertEquals(7.5, interpolatePair(0.0, 10.0, 4.0, 8.0, 5.0), 0.0); }