### Question:
ComputeEnrichment { protected static boolean [] selectCategoriesToReturn(DenseVector qvals, double threshold, int minToReturn) { boolean [] shouldReturn = new boolean[qvals.size()]; DenseVector ranks = qvals.copy(); MatrixUtils.rank(ranks); DenseVector ordered = new DenseVector(qvals.size()); int [] unrank = new int[qvals.size()]; for (int i=0; i<ranks.size(); i++) { int p = (int) Math.round(ranks.get(i))-1; ordered.set(p, qvals.get(i)); unrank[p] = i; } int numSelected = 0; int i = 0; while (i < ranks.size()) { if (ordered.get(i) > threshold) { break; } shouldReturn[unrank[i]] = true; numSelected += 1; i += 1; } while (numSelected < minToReturn && i < ranks.size()) { if (ordered.get(i) > 1) { break; } shouldReturn[unrank[i]] = true; numSelected += 1; i += 1; } return shouldReturn; } ComputeEnrichment(DataCache cache, EnrichmentEngineRequestDto request); EnrichmentEngineResponseDto process(); static double computeHyperGeo(double x, double N, double n, double k); static double computeCumulHyperGeo(double x, double N, double n, double k); static DenseVector computeFDRqval(int N, DenseVector pvals);  }### Answer:
@Test public void testSelectCategoriesToReturn() { double [] qvalsarray = {0.6, 0.2, 0.3, 0.9, 0.8}; DenseVector qvals = new DenseVector(qvalsarray); boolean [] mask = ComputeEnrichment.selectCategoriesToReturn(qvals, .5, 1); assertBooleanArrayEquals(new boolean [] {false, true, true, false, false}, mask); mask = ComputeEnrichment.selectCategoriesToReturn(qvals, .5, 3); assertBooleanArrayEquals(new boolean [] {true, true, true, false, false}, mask); }