title: every combination of a string without repeats java
body: <p>I am a high-school student, relatively new to programming, and am working on a mathematics problem and using java to help me. Anyway, I have run into a problem with memory. I would like to find all the possible combinations of a string without repeats.  </p>
  
  <p>For example, given the string 'AABB' I would want 'AABB', 'ABAB', 'ABBA', 'BBAA', 'BABA', and 'BAAB' returned.  </p>
  
  <p>There is a similar question asked here: <a href="https://stackoverflow.com/questions/9666903/every-combination-of-character-array">Every combination of character array</a>  </p>
  
  <p>The solution provided at this link is in general what I want, however in my case it is unable to handle longer strings. In my specific case I want a method that is able to take a string with 18 characters in it. </p>
  
  <p>Additionally the string which I would like to find all the combinations of, only needs to contain 2 characters; and so, there may be a more efficient way to do it in binary, but I am not sure. </p>
  
  <p>Any help would be greatly appreciated.</p>