<prompt> Kujenga kazi katika Java kupata factorical ya idadi.  <response>: Here is a function in Java that can be used to find the factorial of a given number:javapublic class Factorial public static long factorialint n long result 1; for int i 1; i n; i result result i; return result; public static void mainString args System.out.printlnfactorial5; output should be 120 This function takes an integer as an argument and returns its factorial as a long value. It calculates the result by multiplying all positive integers less than or equal to the input integer. You can test it by calling it in the main method, as shown in the example above. 