Here you can find the source of md5(final File file)
public static String md5(final File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.security.MessageDigest; public class Main { public static String md5(final File file) { try {/* w w w . ja va 2 s.c om*/ final InputStream fin = new FileInputStream(file); final MessageDigest md5 = MessageDigest.getInstance("MD5"); // read file into buffer and update digest byte[] buffer = new byte[1024]; int read; while ((read = fin.read(buffer)) > 0) { md5.update(buffer, 0, read); } fin.close(); // format output byte[] digest = md5.digest(); if (digest == null) return null; String hash = ""; for (int i = 0; i < digest.length; i++) { hash += Integer.toString((digest[i] & 0xff) + 0x100, 16).substring(1); } return hash; } catch (Exception e) { return null; } } }