public static String generatePassword(int length){
  SecureRandom random=new SecureRandom();
  StringBuilder pass=new StringBuilder(length);
  for (int i=0; i < length; i++) {
    pass.append(PASSWORD_ALPHABET[random.nextInt(PASSWORD_ALPHABET.length)]);
  }
  return (pass.toString());
}

public static String generatePassword ( int length ) { SecureRandom random = new SecureRandom ( ) ; StringBuilder pass = new StringBuilder ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { pass . append ( PASSWORD_ALPHABET [ random . nextInt ( PASSWORD_ALPHABET . length ) ] ) ; } return ( pass . toString ( ) ) ; }
generate a random password of the given length .
