Data Structures, Algorithms, & Applications in Java
Chapter 1, Exercise 23

The method is applications.IterativeFactorial.factorial . The code is given below.


/** @return n! */
public static int factorial (int n)
{
   if (n <= 1)
      return 1;
   int fact = 2;
   for (int i = 3; i <= n; i++)
      fact *= i;
   return fact;
}