I am attempting to create a program that will take in a simple password and generate a newer, more complex password with certain characters being changed to special characters e.g(s == $). I've got this done but I would like to have 50% of the remaining characters Uppercase and 50% of them lowercase e.g(p@$$w0rd -> p@$$W0rD). Any ideas on how this would be done? passwordBeginning is a class holding the original simplified password. This is what I've got so far
public String getPassword() {
String temp = passwordBeginning.getPassword();
char[] chars = temp.toCharArray();
for(int i = 0;i<chars.length;i++) {
if(chars.length % 2 == 0) {
chars[i] = Character.toUpperCase(chars[i]);
i++;
}
if(chars.length % 2 >= 1) {
chars[i] = Character.toLowerCase(chars[i]);
}
}
String revert = new String(chars);
temp = revert;
return temp;