In a beginner\'s programming book (free licence) there was the following code, dynamically creating nested loops in Java:
import java.util.Scanner; public c
It might be solved with this library, for example.
In your case you can implement loops so:
new Loops() .from(1).to(4) .from(1).to(4) .action(System.out::println);
The result:
[1, 1] [1, 2] [1, 3] [2, 1] [2, 2] [2, 3] [3, 1] [3, 2] [3, 3]