♠ Posted by ANDROID THIRST in EXAMPLES at 00:37
A simple program in Java that generates a random password combination of Character, Number, Special symbols.
Here is the code snippet to generate random password in java..........
package password.generater;
import java.util.Random;
/**
*
* @author dell
*/
public class PasswordGenerater {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int length= 8;
System.out.println(generatePswd(length));
// TODO code application logic here
}
static char[] generatePswd(int len){
System.out.println("Your Password ");
String charsCaps="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String Chars="abcdefghijklmnopqrstuvwxyz";
String nums="0123456789";
String symbols="!@#$%^&*()_+-=.,/';:?><~*/-+";
String passSymbols=charsCaps + Chars + nums +symbols;
Random rnd=new Random();
char[] password=new char[len];
int index=0;
for(int i=0; i<<len;i++){
password[i]=passSymbols.charAt(rnd.nextInt(passSymbols.length()));
}
return password;
}
}
/>
If you have any doubt then comment below.......
HAPPY PROGRAMMING

1 comments:
Nice Article . Thanks for sharing this useful article.
Strong Password Generator
Post a Comment