title: How to generate various combinations of a string?
body: <p>I have to generate a sequence of strings combination starting with some fixed bits at the beginning, for example,</p>
  
  <pre><code>String password = "abc-----"
  </code></pre>
  
  <p>Here, the first three characters remain the same for every combination, only the characters after that have to change,
  I need various combinations of this string like </p>
  
  <pre><code>abca
  abcb
  abcc
  -----
  abcaa
  abcab
  ---- so on
  </code></pre>
  
  <p>using any loop, so that within the same loop i need to compare this with other input string and output the string, if both match.</p>
  
  <p>How to generate this sequence or various combinations of strings using a loop in Java or in general ?</p>
  
  <p>//update, sorry, i forgot to post what i tried:</p>
  
  <p>i am doing it using nested for loops such as,</p>
  
  <pre><code>for(char i='a'; i&lt;'z'; i++) {
       for(char j='a'; j&lt;'z'; j++) {
           String password = "abc" + i + j ;
           }
        } 
  </code></pre>
  
  <p>Is there any more efficient way to do this ?</p>