generta epassword java

Solutions on MaxInterview for generta epassword java by the best coders in the world

showing results for - "generta epassword java"
Josué
06 Nov 2018
1import java.util.Random;
2
3public class PasswordGenerator {
4	public static String generateRandomPassword(int len) {
5		String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi"
6          +"jklmnopqrstuvwxyz!@#$%&";
7		Random rnd = new Random();
8		StringBuilder sb = new StringBuilder(len);
9		for (int i = 0; i < len; i++)
10			sb.append(chars.charAt(rnd.nextInt(chars.length())));
11		return sb.toString();
12	}
13}
Enrico
12 Mar 2017
1 public static String generateRandomPassword(int length) {
2        Object[][] characterSets = {
3                {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'},
4                {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'},
5                {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
6        };
7        List<Character> passwordCharacters = new ArrayList<>();
8        ThreadLocalRandom random = ThreadLocalRandom.current();
9        for (Object[] characters : characterSets){
10            for (int i = 0; i < length / 3; i++){
11                passwordCharacters.add((Character) characters[random.nextInt(0, characters.length)]);
12            }
13        }
14        for (int i =0; i < length % 3; i++){
15            Object[] characters = characterSets[random.nextInt(0, characterSets.length)];
16            passwordCharacters.add((Character) characters[random.nextInt(0, characters.length)]);
17        }
18        Collections.shuffle(passwordCharacters);
19        StringBuilder stringBuilder = new StringBuilder(length);
20        passwordCharacters.forEach(stringBuilder::append);
21        return stringBuilder.toString();
22    }
queries leading to this page
create password random javaauto generate password in javajava generate password with special characters and numbergenerate strong password javasimple password generator java excercisehow to genrate a random password javajava generate passwordjava random length passwordjava generate random password sjava generate random password with special characterspassword generator javahow to generate a security code javacreate random password 8 characters with special charactersspring bootrandom password generator in jaahow to auto generate password in javahow to generate password randomly in javahow to generate random password in javapassword management in javagenerate random password javajava password generatorjava code for random password generator onlinehow to write a password in javajava generate randome passwordcreate random password 8 characters spring bootgenerate password javapassword generator algorithm javapassword random for javagenerating random password in javajava creat passwordrandom username and password generator in javasecurepassword javapublic class password generatorpassword generator lowercase uppercase number code examplepassword generator spring boot generate random password with validation in javajava secure password generatorgenrating random password using javahow to fix a program to choose a random password for us javagenerate password in java randomly wothout loopsjava random passwordpassword generation in javarandom password suggestion javacreate random password 8 characters javagenerate a random password in javagenerate random password in javahow to generate a random password javagenerate password in javagenerta epassword javahow to generate random password javagenerate password using javajava password pattern javajava generate random passwordjava generate random username and passwordrandom generate password function of javapassword creation javajava generate strong passwordpassword program in javajava random password generator coderandom password in javahow to generate random passwords in javacreate random password javapassword generator with specified numbers and symbols javavalid password program on javajava random password generatorrandom password generator java springreturn generated password javagenerate random password with org passay javarandom password generator in javahow to make a random password generator in javacreate random password 8 characters with special characters spring boothow to create a random password generator in javagenarate random password java coderandom password generator javajava to generate random passwordauto password create in random number in javastring password generator java excercisegenerta epassword java