code: public static double norm(double[] a) {
      double squaredSum = 0;
      for (double anA : a) {
        squaredSum += anA * anA;
      }
      return Math.sqrt(squaredSum);
    }
docs: Computes 2-norm of vector
  
  @param a A vector of double
  @return Euclidean norm of a