Hypergeometric { public double logfact(int i) { if (i > (lfactorial.size() - 1)) { for (int j = lfactorial.size(); j <= i; j++) { double lf = lfactorial.get(j - 1) + Math.log(j); lfactorial.add(j, lf); } } return lfactorial.get(i); } Hypergeometric(); double phypergeometric(int n, double p, int k, int r); double phypergeometric(int m, int m_t, int n, int n_t); double dhyper(int x, int N, int M, int n); double phyper(int x, int N, int M, int n, boolean lowerTail); double lNchooseK(int n, int k); double logfact(int i);  }
@Test void test_factorial() { double expected = 3.178054; assertEquals(expected, hypergeometric.logfact(4), EPSILON); }