Write code to generate Random String
//package com.book2s; import java.util.Random; public class Main { public static void main(String[] argv) { int min = 42; int max = 42; System.out.println(generateRandomString(min, max)); }//from w w w .ja v a2 s .c o m public static String generateRandomString(int min, int max) { String signsSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprqstuvwxyz"; char[] chars = signsSet.toCharArray(); String randString = ""; Random rand = new Random(); int length = rand.nextInt((max - min) + 1) + min; while (length > 0) { randString += chars[rand.nextInt(chars.length)]; length--; } return randString; } }