I hope you Daniel can help me to see what the problem is. Thank you
.import java.io.*;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class CertificateRemind {
    public static X509Certificate x509Certificate = null;
    public static Process process = null;
    public static void MessageRemind(String url,int port){
        Runtime runtime = Runtime.getRuntime();
        try {
            String connect = "openssl s_client -connect " + url + ":" + port;
            process = runtime.exec(connect);
            CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
            x509Certificate = (X509Certificate) certificateFactory.generateCertificate(process.getInputStream());
            System.out.print((x509Certificate.getNotAfter().getTime()-new Date().getTime())/(24*60*60*1000)+"");
            long date = x509Certificate.getNotAfter().getTime();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
            System.out.println(simpleDateFormat.format(date));
        } catch (IOException e) {
            e.printStackTrace();
        } catch (CertificateException e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args)  {
        CertificateRemind.MessageRemind("***.***.***",443);
    }
}
