Java Thread Callable sumOfSquares(final double[] data)

Here you can find the source of sumOfSquares(final double[] data)

Description

sum Of Squares

License

Open Source License

Declaration

public static Callable sumOfSquares(final double[] data) 

Method Source Code


//package com.java2s;
import java.util.concurrent.*;

public class Main {
    public static Callable sumOfSquares(final double[] data) {
        return new Callable() {
            int len = data.length;
            double sum = 0;

            public Object call() throws Exception {
                for (int i = 0; i < data.length; i++) {
                    double temp = data[i];
                    sum += temp * temp;/*from  www . ja  v a2  s.  c  o  m*/
                }
                return sum;
            }
        };
    }
}

Related

  1. runWithTimeout(long millisTimeout, Callable callable)
  2. shuffleRow(final double[] data)
  3. submitAndWait(ListeningExecutorService service, Callable ca)
  4. submitManyAndWait(ListeningExecutorService service, Iterable> cas, FutureCallback fca)
  5. sum(final double[] a)
  6. waitFor(final Process process, final CyclicBarrier onStart)
  7. waitFor(Object o, long ms, Callable c)
  8. waitForCondition(Callable condition, Callable callback, int seconds)