VariableHelper { static short[][] getShortArray(int width, int height, short fillValue) { final short[][] shortArray = new short[width][height]; if (fillValue != 0) { for (int i = 0; i < width; i++) { Arrays.fill(shortArray[i], fillValue); } } return shortArray; }    }
@Test public void testGetFilledArray_shorts_filled() { final int width = 4; final int height = 6; final short[][] array = VariableHelper.getShortArray(width, height, (short) 14); assertEquals(width, array.length); assertEquals(height, array[0].length); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { assertEquals((short)14, array[i][j]); } } }
@Test public void testGetFilledArray_shorts_unfilled() { final int width = 2; final int height = 7; final short[][] array = VariableHelper.getShortArray(width, height, (short)0); assertEquals(width, array.length); assertEquals(height, array[0].length); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { assertEquals((short)0, array[i][j]); } } }