title: Can one initialize a Java string with a single repeated character to a specific length
body: <p>I'd like to create a function that has the following signature:  </p>
  
  <pre><code>public String createString(int length, char ch)
  </code></pre>
  
  <p>It should return a string of repeating characters of the specified length.<br>
  For example if length is 5 and ch is 'p' the return value should be:</p>
  
  <blockquote>
    <p>ppppp</p>
  </blockquote>
  
  <p>Is there a way to do this without looping until it is the required length?<br>
  And without any externally defined constants?</p>