user
You need to complete the following task:

Convert this code to Java

def power_of_two(x):
    if x > 0:
        return x * power_of_two(x-1)
    else:
        return 1

Answer:
assistant
public static int powerOfTwo(int x) {
    if (x > 0) {
        return x * powerOfTwo(x-1);
    }
    return 1;
}