Java snippet to find factorial of a number

factorial in java

Find factorial :-
            int factorial = number;
            for (int i = number - 1; i > 0; i--) {
            factorial = factorial * i;
            }

            System.out.println(factorial);