java random string
public static String getRandomString(int size) {
// The string that we will return
String rand = "";
// The chars that are used to generate the random string
String chars = "1234567890-=!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?";
// Loop based on the requested size
for (int i = 0; i < size; i++) {
// Add a random char from the chars string to the rand string
rand += chars.toCharArray()[new Random().nextInt(chars.length())];
}
// Return the random string
return rand;
}