iの値を新しいスレッドオブジェクトに渡すことは可能ですか?
現在のコード:
int cores = 4;
final int n = 10000;
static double sum = 0.0;
Thread[] threads = new Thread[cores];
for (int i = 0; i < cores; i++)
{
threads[i] = new Thread(new Runnable() {
public void run() {
for (int j = i * (n / cores); j < (i + 1) * N / P; j++) {
double x = (j + 0.5) * step;
sum += 4.0 / (1.0 + x * x);
}
}
});
}
よろしく