title: Return permutations of all sizes of a string
body: <p>I've been googling for hours and can't figure this out! I am attempting to create a program that will return every size of the permutations of a string that's inputed by the user. I have figured out how to return all permutations that match the length of the original inputed string but I can't figure out how to return sub-sets as well! </p>
  
  <p>For example, if the user enters </p>
  
  <p>"abc" </p>
  
  <p>I want to get the results</p>
  
  <p>a
  b
  c
  ab
  ac
  bc
  cb
  abc
  ... etc</p>
  
  <p>so basically all possible permutations of all possible sizes of the provided string.</p>
  
  <p>Any idea what I'm doing wrong/any corrections to the code to fix this?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Arrays;
  
  
  public class Characters extends FindWords {
  
  
  
  /**
   * Gets letters provided by user and then
   * runs the character permutation methods
   * within this class.
   */
  public void chars (){
  
      //acquire string provided in Main file
      String c = getLetters();
  
      //passes the string to the initiate() method
      initiate(c);    
  
  
  }
  
  
  
  
  
  /**
   * initiate the permutation easily using only the inputed string as 
   * the parameter.
   * 
   * @param input
   */
  void initiate( String input)
  {
    //get the length of the given string
    int len = input.length();
  
    //an array of the characters created by user
    char[ ] in = input.toCharArray( );
  
    //a malleable string
    StringBuffer out = new StringBuffer();
  
    //array of bools
    boolean[ ] used = new boolean[ len ];
  
  
    permAction ( in, out, used, len, 0 );
  
  }
  
  
  
  
  
  
  
  
  
  /**
   * Actual action of the permutation
   * 
   * @param in
   * @param out
   * @param used
   * @param len
   * @param x
   */
    void permAction ( char[ ] in, StringBuffer out, 
                      boolean[ ] used, int len, int x){
  
  
       //end the recursion for the word if the counter x is the same length as the string
       if( x == len) {
       System.out.println ( out.toString()); 
       return;
       }
  
  
       //for every letter in the inputed string
      for( int i = 0; i &lt; len; ++i )
      {       
  
          //if true
         if( used[i] ) continue;
  
         //add letter to output string
         out.append( in[i] );      
         used[i] = true; 
  
  
         //recursion call
         permAction( in,   out, used, len, x + 1 );       
         used[i] = false;       
  
         //decrease length by 1
         out.setLength(   out.length() - 1 );   
      }
   }
  
  
  }
  </code></pre>
  
  <p>Thanks in advance for any help! :) </p>
  
  <p>I found some advice on google about using powersets but I am getting even worse luck with those than I am with this particular implementation. </p>