code: public static long binCoeff(int n, int k) {
                  if (k > n) {
                          return 0;
                  }
                  if (k == 0 || k == n) {
                          return 1;
                  }
                  long result = 1;
                  for (int i = 1; i <= k; i++) {
                          result *= (n - i + 1) / i;
                  }
                  return result;
          }
docs: Returns the binomial coefficient.<br>
  For any set containing n elements, this is the number of distinct
  k-element subsets of it.
  
  @param n Set size
  @param k Subset size
  @return The binomial coefficient of <code>n</code> and <code>k</code>