Is this code fine to find possible ways for to reach 10 by rolling dice?

public static ArrayList PW(int x) {
if (x == 0) {
ArrayList basecase = new ArrayList<>();
basecase.add("");
return basecase;
}
ArrayList result = new ArrayList<>();
for (int i = 1; (i <= x) && (i <= 6); i++) {

		for (String element : PW(x - i)) {
			result.add(i + element);
		}
	}
	return result;

}

Hey @kakkarhk Yeah it looks fine.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.