The following program will generate the random password.
import java.util.Random;
public class AutoPwdGenerator {
public String gen8DigitPwd()
{
String strPassword="";
try{
Random randomPassword = new Random();
int i=randomPassword.nextInt(10);
int j = randomPassword.nextInt(100);
int k = randomPassword.nextInt(100);
int l = randomPassword.nextInt(10);
int m = randomPassword.nextInt(10);
strPassword=i+"T"+j+k+"P"+l;
System.out.println("Auto generated password"+strPassword);
}catch(Exception e)
{
e.printStackTrace();
}
return strPassword;
}
}
public class AutoPwdGeneratorTest
{
public static void main(String args[])
{
AutoPwdGenerator autoGen = new AutoPwdGenerator();
String randomPwd = autoGen.gen8DigitPwd();
System.out.println("Generated Random Password:"+randomPwd);
}
}
No comments:
Post a Comment