Here you can find the source of factorial(int n)
public static int factorial(int n)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww.java 2 s. co m * Standard factorial calculation. */ public static int factorial(int n) { if (n == 0) return 1; int fact = 1; for (int i = 1; i <= n; i++) fact *= i; return fact; } }