### Question:
Bicubic extends Interpolation { @Override public float interpolateSampleX(float[] p, float x) { return (float) (p[1] + 0.5 * x * (p[2] - p[0] + x * (2.0 * p[0] - 5.0 * p[1] + 4.0 * p[2] - p[3] + x * (3.0 * (p[1] - p[2]) + p[3] - p[0])))); } Bicubic(float[][] input);  Bicubic(float[][] input, int lenX, int lenY); @Override float interpolateSampleX(float[] p, float x);  }### Answer:
@Test public void testInterpolateSampleX() { float[] samples = new float[]{0,1,2,3}; assertEquals(1.0, instance.interpolateSampleX(samples, 0.0f), 0.001); assertEquals(1.5, instance.interpolateSampleX(samples, 0.5f), 0.001); assertEquals(2.0, instance.interpolateSampleX(samples, 1.0f), 0.001); assertEquals(1.333, instance.interpolateSampleX(samples, 0.333f), 0.001); }
@Test public void testInterpolateSampleX2() { float[] samples = new float[]{2,1,2,1}; assertEquals(1.0, instance.interpolateSampleX(samples, 0.0f), 0.001); assertEquals(1.5, instance.interpolateSampleX(samples, 0.5f), 0.001); assertEquals(2.0, instance.interpolateSampleX(samples, 1.0f), 0.001); assertEquals(1.258, instance.interpolateSampleX(samples, 0.333f), 0.01); }