### Question:
X509CertificateUtils { public static java.security.cert.X509Certificate[] convert(javax.security.cert.X509Certificate[] cert) { java.security.cert.X509Certificate[] ret = new java.security.cert.X509Certificate[cert.length]; for (int i=0; i<cert.length; i++) { ret[i] = convert(cert[i]); } return ret; }  static java.security.cert.X509Certificate[] convert(javax.security.cert.X509Certificate[] cert); static javax.security.cert.X509Certificate[] convert(java.security.cert.X509Certificate[] cert); static java.security.cert.X509Certificate convert(javax.security.cert.X509Certificate cert); static javax.security.cert.X509Certificate convert(java.security.cert.X509Certificate cert);  }### Answer:
@Test public void javaToJavaxToJava() throws Exception { KeyStoreManagement ksm = KeyStoreManagement.getKeyStoreManagement("JKS", new FileSystemResource(KeyStoreManagementTest.getKeystorePath()), "password"); KeyStore ks = ksm.getKeyStore(); long start = System.nanoTime(); java.security.cert.X509Certificate c1 = (java.security.cert.X509Certificate) ks.getCertificate("selfsigned"); javax.security.cert.X509Certificate c2 = X509CertificateUtils.convert(c1); java.security.cert.X509Certificate c3 = X509CertificateUtils.convert(c2); long total = System.nanoTime() - start; System.out.println("Total time: "+total); assertEquals(c1, c3); }
@Test public void javaArrayToJavaxArrayToJavaArray() throws Exception { KeyStoreManagement ksm = KeyStoreManagement.getKeyStoreManagement("JKS", new FileSystemResource(KeyStoreManagementTest.getKeystorePath()), "password"); KeyStore ks = ksm.getKeyStore(); long start = System.nanoTime(); java.security.cert.X509Certificate c1 = (java.security.cert.X509Certificate) ks.getCertificate("selfsigned"); javax.security.cert.X509Certificate[] c2 = X509CertificateUtils.convert(new java.security.cert.X509Certificate[] {c1}); java.security.cert.X509Certificate[] c3 = X509CertificateUtils.convert(c2); long total = System.nanoTime() - start; System.out.println("Total time: "+total); assertEquals(c1, c3[0]); }