Professional Documents
Culture Documents
fahrul_java_rd;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
import java.io.File;
import java.math.BigInteger;
import java.nio.file.Files;
import java.security.MessageDigest;
import java.util.concurrent.Callable;
@Override
public Integer call() throws Exception { // your business logic goes here...
byte[] fileContents = Files.readAllBytes(file.toPath());
byte[] digest =
MessageDigest.getInstance(algorithm).digest(fileContents);
System.out.printf("%0" + (digest.length * 2) + "x%n", new BigInteger(1,
digest));
return 0;
}