rendered paste bodyimport java.util.*;import java.util.regex.*;import java.text.*;public class jTest { private Random rand = new Random(); private String strSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private String str; private int count, matchs; public jTest() { System.out.println("Start Time: " + getDateTime()); while (true) { str = randString(6); Pattern pattern = Pattern.compile(str.charAt(0) + "{6}"); Matcher match = pattern.matcher(str); while (match.find()) { matchs++; printStats(); } count++; } } public String randString(int strLen) { String str = ""; for (int i = 0; i < strLen; i++) { str += strSet.charAt(rand.nextInt(26)); } return str; } public void printStats() { System.out.println("Match: " + str + " - Iterations: " + count + " - Total: " + matchs + " -- Time: " + getDateTime()); System.out.println("-----------------"); } /** * Method getDateTime() * Taken From: http://www.java-tips.org/java-se-tips/java.util/how-to-get-current-date-time.html */ private String getDateTime() { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } public static void main(String args[]) { new jTest(); }}