Java tutorial
//package com.java2s; public class Main { /** * Generate a random message-id header for locally-generated messages. */ public static String generateMessageId() { StringBuffer sb = new StringBuffer(); sb.append("<"); for (int i = 0; i < 24; i++) { sb.append(Integer.toString((int) (Math.random() * 35), 36)); } sb.append("."); sb.append(Long.toString(System.currentTimeMillis())); sb.append("@email.android.com>"); return sb.toString(); } }