Sunday, January 22, 2006

java: Generating unique sequence of numbers

Calendar calendar = Calendar.getInstance(TimeZone.getDefault());

//generate a unique sequential number. We derive this from the
//number of
milliseconds since 00:00:00 GMT Jan. 1, 1970 using //calendar object.
String runNumber = new Long(calendar.getTime().getTime()).toString();

System.out.println(runNumber);

No comments: