Java Permutations Method (Handles Large Numbers)
Permutations are unique orderings for a set. Our favorite flavor of permutations is the nPr formula which calculates the number of subsets that can be selected from the total number of items (order matters!)

note: with nPr the order of the subset matters in the subset (unline nCr where order doesn’t matter)
import java.math.BigInteger;
public class PermutationWork {
public static void main(String[] args) {
BigInteger perms = numPermutations(20,6);
System.out.print(perms);
}
public static BigInteger numPermutations(int totalRecords, int chooseAmt) {
BigInteger result = BigInteger.valueOf(1);
for(int i = 1+totalRecords-chooseAmt; i <= totalRecords; i++) {
result = result.multiply(BigInteger.valueOf(i));
}
return result;
}
}
27907200