I have a Java program which I want to run multiple times in order to get some test results. This program has some global static fields that control certain parameters (e.g. number of neighbours). One of the answers here (How to run a Java program multiple times without JVM exiting?) suggests to call the main method of this program from a wrapper class, but a subsequent comment mentions that this approach wouldn't work with static initialisers. What's the best way to go about this?
Is it also possible to change the values of these static fields depending on which iteration is being performed? Example, for the first 10 iterations I'd like the number of neighbours to be 5 and for the next 10 I'd want to make them 20 and so on.