class FileUtils {

    public static String getFileChecksumSHA256(final File artifactFile) throws IOException {
        MessageDigest digest;
        try {
            digest = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException e) {
            throw new IOException(e);
        }

        try (final FileInputStream fis = new FileInputStream(artifactFile)) {

            final byte[] byteArray = new byte[1024];
            int bytesCount = 0;

            while ((bytesCount = fis.read(byteArray)) != -1) {
                digest.update(byteArray, 0, bytesCount);
            }

        }

        final byte[] bytes = digest.digest();
        final StringBuilder sb = new StringBuilder();

        for (int counter = 0; counter < bytes.length; counter++) {
            sb.append(Integer.toString((bytes[counter] & 0xff) + 0x100, 16).substring(1));
        }

        return sb.toString();
    }

    private  FileUtils();

}