Stat { public static double hg(long D, long gt, long S) { double dgt = 0; for (int i = 1; i <= D - gt; i++) { dgt += Math.log(i); } double ds = 0; for (int i = 1; i <= D - S; i++) { ds += Math.log(i); } double dgts = 0; for (int i = 1; i <= D - gt - S; i++) { dgts += Math.log(i); } double d = 0; for (int i = 1; i <= D; i++) { d += Math.log(i); } double P = Math.exp(dgt + ds - dgts - d); return P; }  static double hg(long D, long gt, long S); static double hgapprox(long D, long gt, int S); static double beta_CDF(double x, int a, int b); static double incompleteBeta(double x, int a, int b); static double beta(int a, int b); static double ix(double x, int a, int b); static double logNfact(long n); static long nFactExact(long n); static double binom(int n, int i); static double logBinom(int n, int i); static double logoggs(double p); static double logit(double logodds); static void main(String[] args);  }
@Test public final void testHg() { System.out.println(Stat.hg(10, 10, 20)); }