title: Print out all the possible combinations of a string
body: <pre><code>public static void combinations(String s) {
      char[] original = s.toCharArray();
      int original_size = s.length();
  
      String temp = new String();
      for (int i = 0; i &lt; original_size; i++) {// add the first element
          String sb = "";
          temp = "";
          sb = "" + original[i];
          temp = sb.toString();
  
          System.out.println(sb);
          for (int j = i + 1; j &lt; original_size; j++) {// add the other
                                                          // element in the
                                                          // array
              if (i == j)
                  continue;
              sb = temp + "" + original[j];
              System.out.println(sb);
          }
          // sb = "";
      }
  }
  
  public static void main(String[] args) {
      combinations("abc");
  }
  </code></pre>
  
  <p>The results should be:
  a, ab, ac, abc, b, bc, c</p>
  
  <p>But my program is:
  a, ab, ac, b, bc, c. I can't print out abc</p>