### Question:
WeightWindows { public static double[] hamming(final int n) { double[] window = new double[n]; for (int i = 0; i < n; i++) { window[i] = 0.54 - 0.46 * Math.cos(2 * Math.PI * ((double) i / (double) (n - 1))); } return window; }  static DoubleMatrix rect(final DoubleMatrix x); static double[] rect(final double[] x); static double[] hamming(final int n); static double[] hamming(final double[] fr, final double br, final double fs, final double alpha); static DoubleMatrix hamming(final DoubleMatrix fr, final double br, final double fs, final double alpha); static double[] inverseHamming(final double[] hamming); static double[] inverseHamming(final double[] fr, final double br, final double fs, final double alpha); static DoubleMatrix inverseHamming(final DoubleMatrix fr, final double br, final double fs, final double alpha);  }### Answer:
@Test public void testHammingArray() throws Exception { double[] hamming_ACTUAL = WeightWindows.hamming(inputAxisHamming, Br, Fs, ALPHA); Assert.assertArrayEquals(hamming_EXPECTED,hamming_ACTUAL, DELTA); }
@Test public void testHammingDoubleMatrix() throws Exception { DoubleMatrix hamming_ACTUAL_MATRIX = WeightWindows.hamming(new DoubleMatrix(inputAxisHamming), Br, Fs, ALPHA); Assert.assertEquals(new DoubleMatrix(hamming_EXPECTED), hamming_ACTUAL_MATRIX); }
@Test public void testSimpleHamming() throws Exception { final int n = 8; double[] hammingWindow_EXPECTED = {0.08, 0.253194691144983, 0.642359629619905, 0.954445679235113, 0.954445679235113, 0.642359629619905, 0.253194691144983, 0.08}; double[] hammingWindow_ACTUAL = WeightWindows.hamming(8); Assert.assertArrayEquals(hammingWindow_EXPECTED, hammingWindow_ACTUAL, DELTA); }