Here you can find the source of normalizeLengthInPlace(double[] in)
public static final void normalizeLengthInPlace(double[] in)
//package com.java2s; //License from project: Apache License public class Main { public static final void normalizeLengthInPlace(double[] in) { double sum = (Math.sqrt(sumSquares(in))); for (int i = 0; i < in.length; i++) { in[i] = in[i] / sum;//from w w w .java2 s. co m } } public static final void normalizeLengthInPlace(float[] in) { float sum = (float) (Math.sqrt(sumSquares(in))); for (int i = 0; i < in.length; i++) { in[i] = in[i] / sum; } } public static final float sumSquares(float[] in) { float sum = 0; for (int i = 0; i < in.length; i++) { sum += (in[i] * in[i]); } return sum; } public static final double sumSquares(double[] in) { float sum = 0; for (int i = 0; i < in.length; i++) { sum += (in[i] * in[i]); } return sum; } }