Java – method that calculates a factorial in Java?

java

I didn't find it, yet. Did I miss something?
I know a factorial method is a common example program for beginners. But wouldn't it be useful to have a standard implementation for this one to reuse?
I could use such a method with standard types (Eg. int, long…) and with BigInteger / BigDecimal, too.

Best Solution

Apache Commons Math has a few factorial methods in the MathUtils class.