title: How divide all items in an array by a double?
body: <p>I am a complete beginner at this and I have a little problem with an array.
  The point of this program is to calculate the normalization of a vector. The first part just calculates the length of the array into the int called sum and then I want to divide all the items in the array v with this sum. normal[] = v[a]/sum; this line is clearly the issue, but how should I do this??</p>
  
  <pre><code>public static double[] normalized(double[] v){
  
      double sum = 0;
  
      for(int counter = 0; counter &lt; v.length; counter++){
          sum += Math.pow(v[counter], 2);
      }
          sum = Math.sqrt(sum);
          double[] normal;
      for(int a = 0; a &lt; v.length; a++){      
          normal[] = v[a]/sum;
      }
  return normal;
  }
  </code></pre>