Java Array Sum Square SumSquared(Object in)

Here you can find the source of SumSquared(Object in)

Description

Sum Squared

License

Open Source License

Declaration

public static final int SumSquared(Object in) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final int SumSquared(Object in) {
        if (in == null)
            return 0;
        if (in instanceof int[]) {
            int[] inn = (int[]) in;
            int out = 0;
            for (int i = 0, s = inn.length; i < s; i++)
                out += inn[i] * inn[i];/*from w  w  w.  j a  va2 s.c om*/
            return out;
        } else {
            int out = 0;
            for (int i = 0, s = ((Object[]) in).length; i < s; i++)
                out += SumSquared(((Object[]) in)[i]);
            return out;
        }
    }
}

Related

  1. sumSq(double... values)
  2. sumSq(double[] a)
  3. sumSqual(byte[] b)
  4. sumSquared(double[] data)
  5. sumSquared(double[] data, double term)
  6. sumSquaredError(double[] a, double[] b)
  7. sumSquareDev(double[] values, double target)
  8. sumSquareDoubleArray(double[] v)
  9. sumSquares(double[] aArray)