code: public static String hexDigest(String algorithm, File[] files) {
          try {
              MessageDigest md = MessageDigest.getInstance(algorithm);
              byte[] buf = new byte[4096];
              for (File f : files) {
                  FileInputStream in = new FileInputStream(f);
                  int nread = in.read(buf);
                  while (nread > 0) {
                      md.update(buf, 0, nread);
                      nread = in.read(buf);
                  }
                  in.close();
              }
              return toHex(md.digest(buf));
          } catch (Exception ex) {
              ex.printStackTrace(System.out);
          }
          return "<error>";
      }
docs: Creates a hex encoded sha-256 hash of all files.
  
  @param algorithm the algorithm to be used.
  @param files the files to include for this hash.
  @return the hexadecimal digest (length 64byte for sha-256).