title: repeat the string sequence until it reaches a certain length in java
body: <p>I have two strings <code>plainText</code> and <code>key</code>. Now, if the <code>plainText.length &gt; key.length</code> then i have to repeat the key until its the same length as that of <code>plainText</code>. here's an example:</p>
  
  <pre><code>plainText = "helloworld"
  key="foobar"
  </code></pre>
  
  <p>hence the key should be increased to "foobarfoob".</p>
  
  <p>One solution is to repeat the entire word and then remove the last characters until it reaches the same length as of plainText like "foobarfoobar" and then remove the characters "ar" .</p>
  
  <p>Is there any better (or rather and Elegant) way to do this in java?</p>