Java Factorial factorial(long l)

Here you can find the source of factorial(long l)

Description

Simple method to calculate the factorial of small values.

License

Open Source License

Parameter

Parameter Description
l Value to calculate the factorial

Return

The factorial of the argument

Declaration

public static long factorial(long l) 

Method Source Code

//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);
    }
}

Related

  1. factorial(int number)
  2. factorial(int value)
  3. factorial(int x)
  4. Factorial(int x)
  5. factorial(int x)
  6. factorial(long n)
  7. factorial(long num)
  8. factorialAsDouble(int n)
  9. factorialAsDoubleIncludeDivisor(int n, double divisor)