title: Improving this code for reversing the string and removing duplicate characters
body: <p>I recently attended an interview where I was asked to write a program.
  The problem was:</p>
  
  <blockquote>
    <p>Take a string. "Hammer", for example.<br>
    Reverse it and any character should not be repeated.<br>
    So, the output will be  - "remaH".</p>
  </blockquote>
  
  <p>This is the solution I gave:</p>
  
  <pre><code>public class Reverse {
      public static void main(String[] args) {
          String str = "Hammer";
          String revStr = "";
  
          for(int i=0; i&lt;=str.length()-1;i++){
              if(revStr.indexOf(str.charAt(i))==-1){
                  revStr = str.charAt(i)+revStr;
              }
          }
          System.out.println(revStr);
      }
  }
  </code></pre>
  
  <p>How I can improve the above?</p>