public static double sumOfSquares(double[] vector){
  double ret=0;
  for (  double d : vector)   ret+=Math.pow(d,2);
  return ret;
}

public static double sumOfSquares ( double [ ] vector ) { double ret = 0 ; for ( double d : vector ) ret += Math . pow ( d , 2 ) ; return ret ; }
this returns the sum of squares for the given vector .
