Java Factorial factorial(int n)

Here you can find the source of factorial(int n)

Description

n!

License

Open Source License

Return

the factorial n! = {|1, (1+x)*y|} n = Γ(n+1).

Declaration

public static long factorial(int n) 

Method Source Code

//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 = &Gamma;(n+1).
     * @internal rewrite pure functional?
     */
    public static long factorial(int n) {
        long r = 1;
        while (n > 0)
            r *= n--;
        return r;
    }
}

Related

  1. factorial(int integer)
  2. factorial(int n)
  3. factorial(int n)
  4. factorial(int n)
  5. factorial(int n)
  6. factorial(int n)
  7. factorial(int n)
  8. factorial(int n)
  9. factorial(int n)