title: Most Efficient Way to Scale an Array in Java?
body: <p>(Apologies if this has been asked before - I can't believe it hasn't, but I couldn't find one. Perhaps my search-fu is weak.)</p>
  
  <p>For years I've "known" that Java has no native function to scale an array (i.e. multiply each element by a constant).  So I've been doing this:</p>
  
  <pre><code>for (int i=0; i&lt;array.length; i++) {
    array[i] = array[i] * scaleFactor;
  }
  </code></pre>
  
  <p>Is this actually the most efficient way (in this application, for example, it's an array of around 10000 doubles)?  Or is there a better way?</p>