基础知识:
- <李>
MessageDigest
李> <李>FileInputStream
李> <李>技巧而((len=in.read(缓冲区,0,1024))!=1){}
李> <李>先导入BigInteger
public static String getFileMD5 (File 文件),{ if (! file.isFile ()), { return 零; } MessageDigest digest =,空; FileInputStream 拷贝=,空; byte 缓冲[],=,new 字节[1024]; int 兰; try { 时间=digest MessageDigest.getInstance (MD5);=,拷贝new FileInputStream(文件); while ((len =, in.read(缓冲,0,1024)),!=,1),{ digest.update(缓冲区,,0,,len); } in.close (); },catch (Exception e), { e.printStackTrace (); return 零; } BigInteger bigInt =, new BigInteger (1, digest.digest ()); return bigInt.toString (16); }