code: public static double factorial(int x) {
      double result = 1.0;
      for (int i=x; i>1; i--) {
        result *= i;
      }
      return result;
    }
docs: Uses floating point so that it can represent the really big numbers that come up.
  @param x Argumet to take factorial of
  @return Factorial of argument