### Question:
SparseBinaryToNetwork { protected void countNonZerosPerFeature(List<int[]> profileData) { numNonZerosPerFeature = new int[numFeatures]; for (int [] g: profileData) { for (int i=0; i<g.length; i++) { numNonZerosPerFeature[g[i]] += 1; } } } SparseBinaryToNetwork(int numGenes, int numFeatures); void convert(List<int[]> profileData, int k); Matrix convertToInteractionMatrix(); int dump(PrintWriter writer, String[] geneNames);  }### Answer:
@Test public void testCountNonZerosPerFeature() { int numFeatures = 10; int [] g1 = {2,4}; int [] g2 = {3,4,9}; int [] g3 = {}; Vector<int[]> profileData = new Vector<int[]>(); profileData.add(g1); profileData.add(g2); profileData.add(g3); int numGenes = profileData.size(); SparseBinaryToNetwork p2n = new SparseBinaryToNetwork(numGenes, numFeatures); p2n.countNonZerosPerFeature(profileData); assertNotNull(p2n.numNonZerosPerFeature); assertEquals(10, p2n.numNonZerosPerFeature.length); assertEquals(0, p2n.numNonZerosPerFeature[0]); assertEquals(0, p2n.numNonZerosPerFeature[1]); assertEquals(1, p2n.numNonZerosPerFeature[2]); assertEquals(1, p2n.numNonZerosPerFeature[3]); assertEquals(2, p2n.numNonZerosPerFeature[4]); assertEquals(0, p2n.numNonZerosPerFeature[5]); assertEquals(0, p2n.numNonZerosPerFeature[6]); assertEquals(0, p2n.numNonZerosPerFeature[7]); assertEquals(0, p2n.numNonZerosPerFeature[8]); assertEquals(1, p2n.numNonZerosPerFeature[9]); }