计算程序运行时间
long startTime = System.currentTimeMillis();
System.out.println("程序运行时间: " + (System.currentTimeMillis() - startTime) + "ms");
获得当前目录
System.getProperty("user.dir")
生成MD5
public String genMd5(final String input) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(input.getBytes());
byte[] digest = m.digest();
BigInteger bigInt = new BigInteger(1, digest);
String hashtext = bigInt.toString(16);
while (hashtext.length() < 32) {
hashtext = "0" + hashtext;
}
return hashtext;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}