### Question:
QuasiRegular { public static void cubicSpline(float[] inpt, int iIdx, double[] y2d, double x, float[] outpt, int oIdx) { int hi; int low; double a; double b; if (java.lang.Math.floor(x) == x) { outpt[oIdx] = inpt[iIdx + (int) x]; return; } hi = (int) (java.lang.Math.ceil(x)); low = (int) (java.lang.Math.floor(x)); a = hi - x; b = x - low; hi = hi > (y2d.length - 1) ? 0 : hi; outpt[oIdx] = (float) (a * inpt[iIdx + low] + b * inpt[iIdx + hi] + ((a * a * a - a) * y2d[low] + (b * b * b - b) * y2d[hi]) / 6.0); }  static float[] convertQuasiGrid(float[] quasi, int[] linePts, int nx, int ny,
      GribData.InterpolationMethod interpolationMethod); static int getMax(int[] vals); static void secondDerivative(float[] inpt, int idx, int n, double x1d, double xnd, double[] y2d); static void cubicSpline(float[] inpt, int iIdx, double[] y2d, double x, float[] outpt, int oIdx); static void linear(float[] inpt, int iIdx, double x, float[] outpt, int oIdx, int npoints);  }### Answer:
@Test public void testCubicSpline() throws IOException { float[] in = new float[] {0.0f, 9.0f, 18.0f, 27.0f}; double[] d2 = new double[4]; QuasiRegular.secondDerivative(in, 0, 4, x1d, xnd, d2); float[] out = new float[8]; QuasiRegular.cubicSpline(in, 0, d2, 0.0, out, 0); assertEquals(0.0, out[0], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 0.5, out, 1); assertEquals(4.5, out[1], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 1.0, out, 2); assertEquals(9.0, out[2], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 1.5, out, 3); assertEquals(13.5, out[3], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 2.0, out, 4); assertEquals(18.0, out[4], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 2.5, out, 5); assertEquals(22.5, out[5], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 3.0, out, 6); assertEquals(27.0, out[6], 0.0); QuasiRegular.cubicSpline(in, 0, d2, 3.5, out, 7); assertEquals(13.5, out[7], 0.0); }