public static String getFileChecksum(String filename, String type) {
        if (filename.equalsIgnoreCase("N/A")) {
            return "null";
        }
        String checksum = null;
        try {
            MessageDigest md = MessageDigest.getInstance(type);
            FileInputStream fis = new FileInputStream(filename);
            byte[] dataBytes = new byte[1024];

            int nread = 0;

            while ((nread = fis.read(dataBytes)) != -1) {
                md.update(dataBytes, 0, nread);
            }

            byte[] mdbytes = md.digest();

            checksum = toHexString(mdbytes);
        } catch (FileNotFoundException ex) {
//            Logger.getLogger(CryptoUtil.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
//            Logger.getLogger(CryptoUtil.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return checksum;
    }