Here you can find the source of factorial(int n)
public static long factorial(int n)
//package com.java2s; public class Main { /**// w w w.j a v a 2 s .co m * n! factorial. * @return the factorial n<b>!</b> = <span class="barbedwireBracket">{|</span>1, (1+x)*y<span class="barbedwireBracket">|}</span> n = Γ(n+1). * @internal rewrite pure functional? */ public static long factorial(int n) { long r = 1; while (n > 0) r *= n--; return r; } }