@Test
public void time() {
long t1 = System.currentTimeMillis();
long t2 = Calendar.getInstance().getTimeInMillis();
long t3 = new Date().getTime();
long per = t3 - t1;
if (per > 10000) {
System.out.println(per);
} else {
String five = String.format("%06d", per);
System.out.println(five);
}
public void time() {
long t1 = System.currentTimeMillis();
long t2 = Calendar.getInstance().getTimeInMillis();
long t3 = new Date().getTime();
long per = t3 - t1;
if (per > 10000) {
System.out.println(per);
} else {
String five = String.format("%06d", per);
System.out.println(five);
}
}
第二种方法
String content = getPara("card");
int strLen = content.length();
while (strLen < 16) {
StringBuffer sb = new StringBuffer();
sb.append("0").append(content);// 左补0
content = sb.toString();
strLen = content.length();
}