Here you can find the source of normalize(float[] input)
public static void normalize(float[] input)
//package com.java2s; //License from project: Open Source License public class Main { /**/*ww w .j a v a 2 s. c om*/ * Normalizes the given input in place to make it unit length. */ public static void normalize(float[] input) { double normSq = 0; for (int i = 0; i < input.length; ++i) { normSq += input[i] * input[i]; } float norm = (float) Math.sqrt(normSq); for (int i = 0; i < input.length; ++i) { input[i] = input[i] / norm; } } }