I understand how it works but if I want to print out the MD5 as String how would I do that?
public static void getMD5(String fileName) throws Exception{
Shortest way:
String toMD5(String input) { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] raw = md.digest(input.getBytes()); return DatatypeConverter.printHexBinary(raw); }
Just remember to handle the exception.