Java Factorial factorial(final long value)

Here you can find the source of factorial(final long value)

Description

Takes the factorial of a value.

License

Open Source License

Parameter

Parameter Description
value - value to take the factorial of

Return

- the value's factorial

Declaration

public static long factorial(final long value) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w w w .j av a  2 s .  c o  m*/
     * Takes the factorial of a value.
     *
     * @param value - value to take the factorial of
     * @return - the value's factorial
     */
    public static long factorial(final long value) {
        long fac = 1;
        for (int i = 0; i < value; i++) {
            fac *= (value - i);
        }

        return fac;
    }
}

Related

  1. factorial(double n)
  2. factorial(double n)
  3. factorial(final int a)
  4. factorial(int c)
  5. factorial(int i)
  6. factorial(int input)
  7. factorial(int integer)