# Android Utililty Methods Binomial Coefficient

List of utility methods to do Binomial Coefficient

## Description

The list of methods to do Binomial Coefficient are organized into topic(s).

## Method

 long binomialCoefficient(final int n, final int k)Returns an exact representation of the Binomial Coefficient, " n choose k ", the number of k -element subsets that can be selected from an n -element set. ```ArithmeticUtils.checkBinomial(n, k); if ((n == k) || (k == 0)) { return 1; if ((k == 1) || (k == n - 1)) { return n; if (k > n / 2) { ... ``` double binomialCoefficientDouble(final int n, final int k)Returns a double representation of the Binomial Coefficient, " n choose k ", the number of k -element subsets that can be selected from an n -element set. ```ArithmeticUtils.checkBinomial(n, k); if ((n == k) || (k == 0)) { return 1d; if ((k == 1) || (k == n - 1)) { return n; if (k > n / 2) { ... ``` double binomialCoefficientLog(final int n, final int k)Returns the natural log of the Binomial Coefficient, " n choose k ", the number of k -element subsets that can be selected from an n -element set. ```ArithmeticUtils.checkBinomial(n, k); if ((n == k) || (k == 0)) { return 0; if ((k == 1) || (k == n - 1)) { return FastMath.log(n); if (n < 67) { ... ``` void checkBinomial(final int n, final int k)Check binomial preconditions. ```if (n < k) { throw new NumberIsTooLargeException( LocalizedFormats.BINOMIAL_INVALID_PARAMETERS_ORDER, k, n, true); if (n < 0) { throw new NotPositiveException( LocalizedFormats.BINOMIAL_NEGATIVE_PARAMETER, n); ... ```