I need to calculate the sum of an arithmetic progression using a loop in several threads. Here is the source code (I create 32 threads). How do I break a loop into all of them? Suppose I want to calculate the amount from 0 to 1,000,000,000 in 3 steps, so that each thread performs a separate part

public class MainClass { public static void main(String arg[]) throws IllegalArgumentException { Refresh() ; } static class MyThread1 extends Thread { @Override public void run() { } } public static void Refresh(){ //create 32 Thread using for loop for (int x = 0; x < 32; x++) { // Create Thread class MyThread1 temp = new MyThread1(); temp.start(); try { temp.join(10); } catch (InterruptedException e) { e.printStackTrace(); } } } 

}

0