title: Sum two arrays element-by-element in Java
body: <p>What is the easiest way to sum two arrays element-by-element?</p>
  
  <p>I know that you can use a <code>for</code> loop such as the following:</p>
  
  <pre><code>int[] a = {0, 1, 2};
  int[] b = {3, 4, 5};
  int[] c = new int[a.length];
  for (int i = 0; i &lt; a.length; ++i) {
      c[i] = a[i] + b[i];
  }
  </code></pre>
  
  <p>But in languages such as MATLAB, you can do the element-by-element array sum by just writing <code>c = a + b</code>. Is there an easy way to do this in Java?</p>
  
  <p>The method that comes to mind is using the RealVector class from Apache Commons Math, but that method is rather verbose.</p>