### Question:
IIRFilterEngine { public double[] filter(double[] input) { int bi, ai, zi; double[] filtered = new double[input.length]; for (int n = 0; n < input.length; n++) { bi = 0; ai = 0; zi = 0; if (bCoefficients.length > 1) { filtered[n] = initialConditions[zi] + bCoefficients[bi] / aCoefficients[0] * input[n]; bi++; ai++; for (; zi < bCoefficients.length - 2; zi++) { initialConditions[zi] = initialConditions[zi + 1] + input[n] * bCoefficients[bi] / aCoefficients[0] - filtered[n] * aCoefficients[ai] / aCoefficients[0]; bi++; ai++; } initialConditions[zi] = input[n] * bCoefficients[bi] / aCoefficients[0] - filtered[n] * aCoefficients[ai] / aCoefficients[0]; } else { filtered[n] = input[n] * bCoefficients[bi ] / aCoefficients[0]; } } return filtered; } IIRFilterEngine(double[] bCoefficients, double[] aCoefficients, double[] initialConditions);  IIRFilterEngine(double[] bCoefficients, double[] aCoefficients); double[] filter(double[] input);  }### Answer:
@Test public void testFilter() { double[] bCoefficients = new double[] {0.00041655, 0.00124964, 0.00124964, 0.00041655}; double[] aCoefficients = new double[] {1. , -2.6861574 , 2.41965511, -0.73016535}; IIRFilterEngine iirFilter = new IIRFilterEngine(bCoefficients, aCoefficients); double[] resultWhole = iirFilter.filter(TestingSignals.SHORT_SIGNAL); double[] firstInput = new double[TestingSignals.SHORT_SIGNAL.length / 2]; double[] secondInput = new double[TestingSignals.SHORT_SIGNAL.length - firstInput.length]; System.arraycopy(TestingSignals.SHORT_SIGNAL, 0, firstInput, 0, firstInput.length); System.arraycopy(TestingSignals.SHORT_SIGNAL, firstInput.length, secondInput, 0, secondInput.length); iirFilter = new IIRFilterEngine(bCoefficients, aCoefficients); double[] firstResult = iirFilter.filter(firstInput); double[] secondResult = iirFilter.filter(secondInput); double[] resultParts = new double[firstResult.length + secondResult.length]; System.arraycopy(firstResult, 0, resultParts, 0, firstResult.length); System.arraycopy(secondResult, 0, resultParts, firstResult.length, secondResult.length); assertArrayEquals(resultWhole, resultParts, 1e-5); }