title: Fastest way to set all values of an array?
body: <p>I have a <code>char []</code>, and I want to set the value of every index to the same <code>char</code> value.<br>
  There is the obvious way to do it (iteration):</p>
  
  <pre><code>  char f = '+';
    char [] c = new char [50];
    for(int i = 0; i &lt; c.length; i++){
        c[i] = f;
    }
  </code></pre>
  
  <p>But I was wondering if there's a way that I can utilize <code>System.arraycopy</code> or something equivalent that would bypass the need to iterate. Is there a way to do that?</p>
  
  <p><strong>EDIT :</strong>
  From <code>Arrays.java</code></p>
  
  <pre><code>public static void fill(char[] a, int fromIndex, int toIndex, char val) {
          rangeCheck(a.length, fromIndex, toIndex);
          for (int i = fromIndex; i &lt; toIndex; i++)
              a[i] = val;
      }
  </code></pre>
  
  <p>This is exactly the same process, which shows that there might not be a better way to do this.
  <br>+1 to everyone who suggested <code>fill</code> anyway - you're all correct and thank you.</p>