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;
  }
}

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 ; } }
normalizes the given input in place to make it unit length .
