title: Parallelize a for loop using multi-threading in java
body: <p>I have a for loop in java with the following structure that I need to parallelize into a fixed number of threads. Lets say that number is in <code>numThreads</code>. The for loop is given below. Note that only the outer loop needs to be parallelized. I think I need to use Executor but I can't figure out how to split the workload into different threads, and if that will change my indexes inside the loop in statements like <code>isInsulator[x][y]</code>. basically I want different threads splitting the value of X and running a for loop for those x values assigned to them. Does that make sense? Can anyone help me achieve this or maybe push me in the right direction please? </p>