### Question:
ArrayGrid implements Grid { public void setSample(int x, int y, double sample) { checkBounds(x, y); final int index = y * width + x; array.setDouble(index, sample); } 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 testSetSample() { final ArrayGrid arrayGrid = ArrayGrid.create(GridDef.createGlobal(0.05), (double[]) null); assertEquals(0.0, arrayGrid.getSampleDouble(19, 108), 1e-8); arrayGrid.setSample(19, 108, 22.8); assertEquals(22.8, arrayGrid.getSampleDouble(19, 108), 1e-8); }