code: public static Password getPassword(String realm,String dft, String promptDft)
      {
          String passwd=System.getProperty(realm,dft);
          if (passwd==null || passwd.length()==0)
          {
              try
              {
                  System.out.print(realm+
                                   ((promptDft!=null && promptDft.length()>0)
                                    ?" [dft]":"")+" : ");
                  System.out.flush();
                  byte[] buf = new byte[512];
                  int len=System.in.read(buf);
                  if (len>0)
                      passwd=new String(buf,0,len).trim();
              }
              catch(IOException e)
              {
                  log.warn(LogSupport.EXCEPTION,e);
              }
              if (passwd==null || passwd.length()==0)
                  passwd=promptDft;
          }
          return new Password(passwd);
      }
docs: Get a password.
  A password is obtained by trying <UL>
  <LI>Calling <Code>System.getProperty(realm,dft)</Code>
  <LI>Prompting for a password
  <LI>Using promptDft if nothing was entered.
  </UL>
  @param realm The realm name for the password, used as a SystemProperty name.
  @param dft The default password.
  @param promptDft The default to use if prompting for the password.
  @return Password