1、普通单线程累加例子
package ForkJoinTest;
import java.util.Random;
public class MakeArray {
public static final int ARRAY_LENGTH= 400000000;
public static final int THRESHOLD= 47;
public static int[] makeArray(){
Random r = new Random();
int[] result =new int[ARRAY_LENGTH];
for( int i = 0 ; i<ARRAY_LENGTH;i++){
result[i]=r.nextInt(ARRAY_LENGTH*3);
}
return result;
}
public static void main(String[] args) {
int count = 0 ;
int[] src = MakeArray.makeArray();
long start = System.currentTimeMillis();
for(int i = 0 ; i < src.length;i++ ){
count = count+src[i];
}
System.out.println("the count is