import java.io.File;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
public class Main {
/**
* Returns n!. Shorthand for n
* href="http://mathworld.wolfram.com/Factorial.html"> Factorial, the
* product of the numbers 1,...,n
.
*
* Preconditions:
*
* -
n >= 0
(otherwise
* IllegalArgumentException
is thrown)
* - The result is small enough to fit into a
long
. The
* largest value of n
for which n!
<
* Long.MAX_VALUE
is 20. If the computed value exceeds Long.MAX_VALUE
ArithMeticException
is thrown.n!
n
* href="http://mathworld.wolfram.com/Factorial.html"> Factorial, the1,...,n
as a double
.
* Preconditions:
*
n >= 0
(otherwiseIllegalArgumentException
is thrown)double
. Then
for which n!
<n!
* Preconditions:
*
n >= 0
(otherwiseIllegalArgumentException
is thrown)n!