Friday, August 18, 2023

Password Generation2

 import java.util.Random;

public class PasswordGeneration2 {

static String passwordGenerator2() {

int length = 15;

String password = "";

String numbers = "1234567890";

String speacialCharacters = "!@#$%";

// String speacialCharacters = "";

String upperCaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

String lowerCaseLetters = "abcdefghijklmnopqrstuvwxyz";

String passowrConcat = upperCaseLetters + lowerCaseLetters + speacialCharacters + numbers;

Random random = new Random();

for (int i = 0; i < length; i++) {

int index = random.nextInt(passowrConcat.length());

password += passowrConcat.charAt(index);

}

return password;

}

public static void main(String[] args) {

String retValue = passwordGenerator2();

}

}


No comments:

Post a Comment

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...