title: Removing duplicates from a String in Java
body: <p>I am trying to iterate through a string in order to remove the duplicates characters.</p>
  
  <p>For example the String <code>aabbccdef</code> should become <code>abcdef</code>
  and the String <code>abcdabcd</code> should become <code>abcd</code></p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>public class test {
  
      public static void main(String[] args) {
  
          String input = new String("abbc");
          String output = new String();
  
          for (int i = 0; i &lt; input.length(); i++) {
              for (int j = 0; j &lt; output.length(); j++) {
                  if (input.charAt(i) != output.charAt(j)) {
                      output = output + input.charAt(i);
                  }
              }
          }
  
          System.out.println(output);
  
      }
  
  }
  </code></pre>
  
  <p>What is the best way to do this?</p>