GaussianGridConfig { static GaussianGridConfig load(int rowCount) throws IOException { if (Arrays.binarySearch(ALLOWED_ROW_COUNTS, rowCount) < 0) { String msg = String.format("Invalid rowCount. Must be one of {%s}, but is %d", StringUtils.arrayToCsv(ALLOWED_ROW_COUNTS), rowCount); throw new IllegalArgumentException(msg); } int numRecords = rowCount * 2; int regularColumnCount = rowCount * 4; int[] reducedColumnCount = new int[numRecords]; double[] latitudePoints = new double[numRecords]; int[] reducedFirstBinIndexes = new int[numRecords]; readGridConfig(rowCount, numRecords, reducedColumnCount, latitudePoints, reducedFirstBinIndexes); GaussianGridConfig config = new GaussianGridConfig(); config.regularColumnCount = regularColumnCount; config.regularLongitudePoints = computeLongitudePoints(regularColumnCount); config.reducedLongitudePoints = new ArrayList<>(numRecords); for (int i = 0; i < numRecords; i++) { double[] longitudePointsInRow = computeLongitudePoints(reducedColumnCount[i]); config.reducedLongitudePoints.add(i, longitudePointsInRow); } config.reducedColumnCount = reducedColumnCount; config.reducedFirstBinIndexes = reducedFirstBinIndexes; config.latitudePoints = latitudePoints; return config; } private  GaussianGridConfig();   }
@Test(expected = IllegalArgumentException.class) public void testException() throws Exception { GaussianGridConfig.load(100); }