阅码场AIKit人工智能项目实战 - TensorFlow篇
public class ArraySumForForkJoinPool {
public static int sumParallel(int[] array) throws ExecutionException, InterruptedException {
ForkJoinPool pool = new ForkJoinPool();
return pool.submit(new SubArraySum(array, 0, array.length - 1)).get();
}
public static void main(String[] args) throws ExecutionException, InterruptedException {
System.out.println(sumParallel(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9}));
}