public class Test {
private static long n = 1;
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
System.out.println(test(n));
}

}

public static long test(long l) {
Date d = new Date();
String str = new SimpleDateFormat("yyyyMMdd") .format(d);
long m = Long.parseLong((str)) * 10000;
long ret = m + l;
n = l + 1;
return ret;
}
}

生成规则是:年+月+日+**** ,比如201504210001