public class Digest {
	private static String[] algorithms = {"MD5", "SHA-1", "SHA-256"};
	public static void main(String[] args) {
		if (args.length < 2 || args[0].equals("--help")) {
			printUsageAndExit();
		}
		String algorithm;
		try {
			algorithm = checkAlgorithm(args[0]);
		} catch (IllegalArgumentException ex) {
			System.err.println(ex.getMessage());
			printUsageAndExit();
			return;
		}
	}
	
	private static String checkAlgorithm(String algorithm) {
		for (String elem : algorithms) {
			if (algorithm.equals(elem)) {
				return algorithm;
			}
		}
		throw new IllegalArgumentException("Unrecognised algorithm: " + algorithm);
	}
	
	private static void printUsageAndExit() {
		System.err.println("Usage: java Digest <function_name> <file1> file2> ...\n" +
		                   "    <function_name> options include: ");
		for (String algorithm : algorithms) {
			System.err.println("                                    " + algorithm);
		}
		System.exit(1);
	}
}
@@ -1,12 +1,253 @@
+import java.io.File;%0Aimport java.io.BufferedInputStream;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.security.DigestInputStream;%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A%0A
 public class
@@ -442,16 +442,27 @@
 Exit();%0A
+%09%09%09return;%0A
 %09%09%7D%0A%09%09St
@@ -479,58 +479,202 @@
 ithm
-;%0A%09%09try %7B%0A%09%09%09algorithm = checkAlgorithm(args%5B0%5D
+ = args%5B0%5D;%0A%09%09// Main loop.%0A%09%09for (int i = 1; i %3C args.length; i++) %7B%0A%09%09%09try %7B%0A%09%09%09%09File input = new File(args%5Bi%5D);%0A%09%09%09%09byte%5B%5D digest = computeDigest(input, algorithm);%0A%09%09%09%09printDigest(digest
 );%0A
+%09
 %09%09%7D 
@@ -681,30 +681,127 @@
 catch (I
-llegalArgument
+OException ex) %7B%0A%09%09%09%09System.err.println(%22Warning: Error reading file: %22 + args%5Bi%5D);%0A%09%09%09%7D catch (NoSuchAlgorithm
 Exceptio
@@ -804,24 +804,25 @@
 ption ex) %7B%0A
+%09
 %09%09%09System.er
@@ -835,69 +835,674 @@
 tln(
-ex.getMessage());%0A%09%09%09printUsageAndExit();%0A%09%09%09return;%0A%09%09%7D%0A%09%7D%0A%09
+%22Unknown algorithm: %22 + algorithm);%0A%09%09%09%09printUsageAndExit();%0A%09%09%09%09return;%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09private static byte%5B%5D computeDigest(File input, String algorithm)%0A%09        throws IOException, NoSuchAlgorithmException %7B%0A%09%09try (DigestInputStream stream = new DigestInputStream(%0A%09%09        new BufferedInputStream(new FileInputStream(input)),%0A%09%09        MessageDigest.getInstance(algorithm))) %7B%0A%09%09%09while (stream.read() != -1);%0A%09%09%09MessageDigest digest = stream.getMessageDigest();%0A%09%09%09return digest.digest();%0A%09%09%7D%0A%09%7D%0A%09%0A%09private static void printDigest(byte%5B%5D digest) %7B%0A%09%09for (int i = 0; i %3C digest.length; i++) %7B%0A%09%09%09System.out.printf(%22%25x%22, digest%5Bi%5D);%0A%09%09%7D%0A%09%09System.out.println();%0A%09%7D%0A
 %0A%09pr
@@ -1732,25 +1732,24 @@
 orithm);%0A%09%7D%0A
-%09
 %0A%09private st

Make working version