Java Password Generate generatePassword(int lenght)

Here you can find the source of generatePassword(int lenght)

Description

generate Password

License

Apache License

Declaration

public static String generatePassword(int lenght) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static char[] _goodChar = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r',
            's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P',
            'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-',
            '@', };
    private static java.util.Random _random = new java.util.Random();

    public static String generatePassword(int lenght) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < lenght; i++) {
            sb.append(_goodChar[_random.nextInt(_goodChar.length)]);
        }//  w w  w.  j a v a 2s .c  o m
        return sb.toString();
    }
}

Related

  1. generatePassword()
  2. generatePassword()
  3. generatePassword()
  4. generatePassword()
  5. generatePassword()
  6. generatePassword(int length)
  7. generatePassword(int length)
  8. generatePassword(int length, boolean special)
  9. generatePassword(int length, String combination)