You will receive a mathematical problem requiring some form of calculation. Your task is to analyze and articulate the logical approach needed to transform the input into the expected output. Then, formulate a prompt that effectively communicates the requirements to the language model, ensuring it generates an implementation in Java.
MyMath.custom_factorial(0) => 1
MyMath.custom_factorial(3) => 6
MyMath.custom_factorial(5) => 120