### Question:
NetworkNormalizer { public static void sparsifyRowsTopKPositives(Matrix m, int k) { for (int i = 0; i < m.numRows(); i++) { Vector v = MatrixUtils.extractRowToVector(m, i); int[] indices = MatrixUtils.getIndicesForSortedValues(v); for (int j = k; j < indices.length; j++) { if (v.get(indices[j]) > 0) { m.set(i, indices[j], 0); } else { break; } } } }  String getOutType(); void setOutType(String outType); static void main(String[] args); String getInFilename(); void setInFilename(String inFilename); String getOutFilename(); void setOutFilename(String outFilename); String getLogFilename(); void setLogFilename(String logFilename); String getSynFilename(); void setSynFilename(String synFilename); String getNormalize(); void setNormalize(String normalize); boolean isNormalizationEnabled(); void setNormalizationEnabled(boolean isNormalizationEnabled); void process(); Matrix loadNetwork(Reader source, char delim, int sourceColNum, int targetColNum, int weightColNum); static void sparsifyRowsTopKPositives(Matrix m, int k); void writeNetwork();  }### Answer:
@Test public void testSparsify() { Matrix data = new CompColMatrix(new DenseMatrix(new double [][] {{1,2,3,4},{6,4,2,5},{7,8,9,0}})); Matrix expectedResult = new CompColMatrix(new DenseMatrix(new double[][] {{0,0,3,4},{6,0,0,5},{0,8,9,0}})); NetworkNormalizer.sparsifyRowsTopKPositives(data, 2); Utils.elementWiseCompare(expectedResult, data, 0d); }