Here you can find the source of length(double[] a)
Parameter | Description |
---|---|
a | The array to calculate the average for. |
public static double length(double[] a)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w .j a v a 2 s. c om * @param a The array to calculate the average for. * @return The average over all elements in the array. */ public static double length(double[] a) { double c = 0; for (int i = 0; i < a.length; i++) c += a[i] * a[i]; return Math.sqrt(c); } }