### Question:
FilterFrequencyResponseCalculator extends FilterResponseCalculator { public FilterFrequencyResponse getGroupDelayResponse() { int fftSize = numberOfPoints * 2; double[] freq = new double[fftSize]; int i; for (i = 0; i < fftSize; i++) { freq[i] = samplingFrequency * i / fftSize; } int oa = filterCoefficients.getACoefficients().length - 1; int oc = oa + filterCoefficients.getBCoefficients().length - 1; double[] c = ArrayOperations.convolve( filterCoefficients.getBCoefficients(), ArrayOperations.reverse(filterCoefficients.getACoefficients())); double[] cr = new double[oc + 1]; for (i = 0; i < cr.length; i++) { cr[i] = c[i] * i; } cr = ArrayOperations.padArrayWithZerosToSize(cr, fftSize); FourierTransform fourierTransform = new FourierTransform(); Complex[] numerator = fourierTransform.forwardFFT(cr); c = ArrayOperations.padArrayWithZerosToSize(c, fftSize); Complex[] denominator = fourierTransform.forwardFFT(c); double minmag = SpecialMath.getMachineEpsilon() * 10; for (i = 0; i < denominator.length; i++) { if (denominator[i].abs() < minmag) { logger.debug("group delay singular - setting to 0"); numerator[i] = new Complex(0, 0); denominator[i] = new Complex(1, 0); } } double[] groupDelay = new double[c.length]; for (i = 0; i < groupDelay.length; i++) { groupDelay[i] = (numerator[i].divide(denominator[i])).getReal() - oa; } groupDelay = ArrayOperations.trimArrayToSize(groupDelay, fftSize / 2); freq = ArrayOperations.trimArrayToSize(freq, fftSize / 2); FilterFrequencyResponse filterResponse = new FilterFrequencyResponse(freq.length); filterResponse.setFrequencies(freq); filterResponse.setValues(groupDelay); return filterResponse; } FilterFrequencyResponseCalculator(int numberOfPoints, double samplingFrequency, FilterCoefficients filterCoefficients); FilterCoefficients getFilterCoefficients(); FilterFrequencyResponse getMagnitudeResponse(); FilterFrequencyResponse getPhaseShiftInDegrees(); FilterFrequencyResponse getGroupDelayResponse();  }### Answer:
@Test public void testGetGroupDelayResponse() { FilterCoefficients coeffs = new FilterCoefficients( new double[] {0.0562, -0.0260, -0.0603, -0.0260, 0.0562}, new double[] {1.0000, -3.0870, 3.7266, -2.1103, 0.4806}); FilterFrequencyResponseCalculator calc = new FilterFrequencyResponseCalculator(512, 128, coeffs); FilterFrequencyResponse groupDelay = calc.getGroupDelayResponse(); assertEquals(512, groupDelay.getValues().length); double[] actual = ArrayOperations.trimArrayToSize(groupDelay.getValues(), 10); assertArrayEquals(new double[] {6.2727, 6.2833, 6.3153, 6.3688, 6.4443, 6.5423, 6.6636, 6.8091, 6.9796, 7.1763}, actual, 0.001); assertEquals(512, groupDelay.getFrequencies().length); actual = ArrayOperations.trimArrayToSize(groupDelay.getFrequencies(), 10); assertArrayEquals(new double[] {0, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000, 1.1250}, actual, 0.001); }