title: How to Generate Password with compulsory one special character , one Upper case, one lower case In JAVA?
body: <p>Suppose I am taking input parameter as <code>int</code> and I want to return in String. How can I do this? I want compulsory one special character, one upper case, one lower case every time after generating password. How can I do this?</p>
  
  <p>I wrote this code below and I get a solution but it does not add upper case, lower case, special characters in the generated output every time.</p>
  
  <pre><code>public int GeneratePassword(int length) {
      String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu vwxyz0123456789~`!@#$%^&amp;*()-_=+[{]}\\|;:\'\",&lt;.&gt;/?";
  
      String pwd = RandomStringUtils.random(length , characters );
      System.out.println("pwd:="+pwd );
  
      return 0;
  }
  </code></pre>