Here you can find the source of binomialCoefficients(int n, int k)
public static long binomialCoefficients(int n, int k)
//package com.java2s; public class Main { public static long binomialCoefficients(int n, int k) { long Ank = 1; if (k < 0 || k > n) { return 0; }//from w w w .j ava 2 s . com long i = n - k + 1; while (i <= n && Ank >= 0) { Ank = Ank * i; i = i + 1; } if (Ank < 0) return Integer.MAX_VALUE; return Ank; } }