code: public static boolean verify(
        Signature signatureAlgorithm, PublicKey publicKey, byte[] signatureBytes, byte[] contentBytes)
        throws InvalidKeyException, SignatureException {
      signatureAlgorithm.initVerify(publicKey);
      signatureAlgorithm.update(contentBytes);
      // SignatureException may be thrown if we are tring the wrong key.
      try {
        return signatureAlgorithm.verify(signatureBytes);
      } catch (SignatureException e) {
        return false;
      }
    }
docs: Verifies the signature of signed content based on a public key.
  
  @param signatureAlgorithm signature algorithm
  @param publicKey public key
  @param signatureBytes signature bytes
  @param contentBytes content bytes
  @return whether the signature was verified