code: public static String fingerprint( X509Certificate cert ) throws CertificateException
      {
          try
          {
              MessageDigest md = MessageDigest.getInstance( "SHA-512" );
              md.update( cert.getEncoded() );
              return ByteBufUtil.hexDump( md.digest() );
          }
          catch( NoSuchAlgorithmException e )
          {
              // SHA-1 not available
              throw new CertificateException( "Cannot use TLS on this platform, because SHA-512 message digest algorithm is not available: " + e.getMessage(), e );
          }
      }
docs: Calculate the certificate fingerprint - simply the SHA-512 hash of the DER-encoded certificate.