code: public static X509Certificate getCertfromPEM(byte[] pemBytes)
              throws IOException, CertificateException, NoSuchProviderException {
          InputStream inStrm = new java.io.ByteArrayInputStream(pemBytes);
          X509Certificate cert = getCertfromPEM(inStrm);
          return cert;
      }
docs: Reads a certificate in PEM-format from a byte array. The array may contain
  other things, the first certificate in the array is read.
  
  @param pemBytes
  the byte array containing the certificate in PEM-format
  @return X509Certificate
  @exception IOException
  if the array cannot be read.
  @exception CertificateException
  if the array does not contain a correct certificate.
  @throws NoSuchProviderException
  NoSuchProviderException