Here you can find the source of getRandomNum()
public static String getRandomNum()
//package com.java2s; import java.text.SimpleDateFormat; public class Main { public static final String DATE_FORMAT_YYYYMMDDHHMM = "yyyyMMddHHmm"; public static String getRandomNum() { StringBuffer sb = new StringBuffer(); sb.append(dataToString(new java.util.Date(), DATE_FORMAT_YYYYMMDDHHMM)); sb.append(String.valueOf(Math.round(Math.random() * 8999 + 1000))); return sb.toString(); }// www . ja v a 2 s.c o m public static String dataToString(Object date, String format) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(date); } }