### Question:
ArrayGrid implements Grid { @Override public double getSampleDouble(int x, int y) { checkBounds(x, y); final int index = y * width + x; final double sample = array.getDouble(index); if (fillTest.isFill(sample)) { return Double.NaN; } return scaling * sample + offset; } ArrayGrid(GridDef gridDef, Array array, final Number fillValue, double scaling, double offset); static Grid create(GridDef gridDef, float[] data); static ArrayGrid create(GridDef gridDef, double[] data); int getWidth(); int getHeight(); double getScaling(); double getOffset(); @Override GridDef getGridDef(); @Override boolean getSampleBoolean(int x, int y); @Override int getSampleInt(int x, int y); @Override double getSampleDouble(int x, int y); void setSample(int x, int y, double sample);  }### Answer:
@Test public void testFillValue() throws Exception { double[] expected = new double[]{ NaN, 0.2, NaN, 0.4, 0.1, 0.2, NaN, 0.4, NaN, 0.3, NaN, NaN, 0.2, 0.3, 0.4, NaN, 0.3, NaN, 0.1, 0.2, 0.3, 0.4, NaN, NaN, NaN, 0.1, 0.2, 0.3, 0.4, 0.1, NaN, NaN, }; double[] actual = new double[expected.length]; for (int i = 0; i < actual.length; i++) { actual[i] = arrayGrid.getSampleDouble(i % 8, i / 8); } assertArrayEquals(expected, actual, 1e-10); }