Here you can find the source of factorial(long l)
Parameter | Description |
---|---|
l | Value to calculate the factorial |
public static long factorial(long l)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . j a v a2 s . c o m * Simple method to calculate the factorial of small values. No checks are performed. Use with caution. * * @param l Value to calculate the factorial * @return The factorial of the argument */ public static long factorial(long l) { if (l <= 2) return l; return l * factorial(l - 1); } }