I have a string which has uppercase & lowercase letters with numbers and @ symbol which I have split up into individual elements. The goal here was to create this simple brute force code that cycles through the string and returns the element given the counter. It's inefficient and slow.
private static String allCharacters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890@";
public static void main(String[] args) {
String pass;
//split into individual letters
String[]text = allCharacters.split("");
for (int counter = 0; counter < text.length; counter++) {
for (int c2 = 0; c2 < text.length; c2++) {
pass = text[counter] + text[c2];
System.out.println(pass);
}
}
}
I also want to add a certain length instead of using multiple for loops, Any tips ?