Answers for "generate strong password java"

1

generate random password in java

import java.util.Random;

public class PasswordGenerator {
	public static String generateRandomPassword(int len) {
		String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi"
          +"jklmnopqrstuvwxyz!@#$%&";
		Random rnd = new Random();
		StringBuilder sb = new StringBuilder(len);
		for (int i = 0; i < len; i++)
			sb.append(chars.charAt(rnd.nextInt(chars.length())));
		return sb.toString();
	}
}
Posted by: Guest on July-16-2020

Code answers related to "generate strong password java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language