Here you can find the source of length(double[] v)
public static double length(double[] v)
//package com.java2s; //License from project: Open Source License public class Main { public static double length(double[] v) { return Math.sqrt(lengthSquare(v)); }// www . jav a 2 s . c om public static double lengthSquare(double[] v) { double s = 0; for (double x : v) { s += x * x; } return s; } }