code: public static double approximateBinomialCoefficient(int n, int k) {
      final int m = max(k, n - k);
      long temp = 1;
      for(int i = n, j = 1; i > m; i--, j++) {
        temp = temp * i / j;
      }
      return temp;
    }
docs: Binomial coefficent, also known as "n choose k").
  
  @param n Total number of samples. n &gt; 0
  @param k Number of elements to choose. <code>n &gt;= k</code>,
  <code>k &gt;= 0</code>
  @return n! / (k! * (n-k)!)