### Question:
PhaseFilter { public static DoubleMatrix arrangeKernel2d(DoubleMatrix kernel2dIn, final double scaleFactor) { final int kernelLines = kernel2dIn.rows; final int kernelPixels = kernel2dIn.columns; final int size = kernelLines; final int hbsL = (kernelLines / 2); final int hbsP = (kernelPixels / 2); final int extraL = isEven(kernelLines) ? 1 : 0; final int extraP = isEven(kernelPixels) ? 1 : 0; DoubleMatrix kernel2dOut = new DoubleMatrix(size, size); int rowCnt = 0; int colCnt; for (int ii = -hbsL + extraL; ii <= hbsL; ++ii) { colCnt = 0; final int indexii = (ii + size) % size; for (int jj = -hbsP + extraP; jj <= hbsP; ++jj) { final int indexjj = (jj + size) % size; kernel2dOut.put(indexii, indexjj, kernel2dIn.get(rowCnt, colCnt)); colCnt++; } rowCnt++; } if (scaleFactor != 1) { kernel2dOut.muli(scaleFactor); } return kernel2dOut; } PhaseFilter(String method, ComplexDoubleMatrix data, int blockSize, int overlap, double[] kernelArray, float goldsteinAlpha); void setMethod(String method); void setData(ComplexDoubleMatrix data); ComplexDoubleMatrix getData(); void setBlockSize(int blockSize); void setOverlap(int overlap); void setKernelArray(double[] kernelArray); void setGoldsteinAlpha(float goldsteinAlpha); void setKernel2d(ComplexDoubleMatrix kernel2d); void filter(); static DoubleMatrix arrangeKernel2d(DoubleMatrix kernel2dIn, final double scaleFactor); @Deprecated static DoubleMatrix smoothSpace(final DoubleMatrix data, final int blockSize);  }### Answer:
@Test public void TestArrangingKernel() throws Exception { final int scalefactor = 1; DoubleMatrix arrangedKernel2d_ACTUAL = PhaseFilterUtils.arrangeKernel2d(kernel2d, scalefactor); String kernel2dFileName = testDirectorySpectral + "kernel2d.r4.swap"; FloatMatrix arrangedKernel2d_EXPECTED = readFloatData(kernel2dFileName, 32, 32); Assert.assertArrayEquals(arrangedKernel2d_EXPECTED.toArray(), arrangedKernel2d_ACTUAL.toFloat().toArray(), (float) DELTA_01); }