public static int getROTDiameter(String certLoc){
		int diameter = 0;
		//instantiate the first certificate, and then loop from there
		try{
		@SuppressWarnings("resource")
		FileInputStream fis = new FileInputStream(certLoc);
    	ByteArrayInputStream bis = null;
    	byte value[] = new byte[fis.available()];
    	fis.read(value);
    	bis = new ByteArrayInputStream(value);
    	CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
    	X509Certificate cert = (X509Certificate)certFactory.generateCertificate(bis);
    	
    	//System.out.println("First Succeeded");
    	
    	//Instantiate the first certificate's issuer's cert, ready for a loop to check
    	String certIssuerPath = "./ServerCertificates/" + cert.getIssuerDN().getName() + ".cer";
    	//System.out.println(certIssuerPath);

    	
		@SuppressWarnings("resource")
		FileInputStream fisCheck = new FileInputStream(certIssuerPath);
    	ByteArrayInputStream bisCheck = null;
    	byte valueCheck[] = new byte[fisCheck.available()];
    	fisCheck.read(valueCheck);
    	bisCheck = new ByteArrayInputStream(valueCheck);
    	X509Certificate certCheck = (X509Certificate)certFactory.generateCertificate(bisCheck);
    	diameter++;
    	
    	//System.out.println("Second Succeeded");
    	while(!(cert.equals(certCheck))){
    		certIssuerPath = "./ServerCertificates/" + certCheck.getIssuerDN().getName();
    		
    		@SuppressWarnings("resource")
    		FileInputStream fisCheck2 = new FileInputStream(certIssuerPath + ".cer");
        	ByteArrayInputStream bisCheck2 = null;
        	byte valueCheck2[] = new byte[fisCheck2.available()];
        	fisCheck2.read(valueCheck2);
        	bisCheck2 = new ByteArrayInputStream(valueCheck2);
        	certCheck = (X509Certificate)certFactory.generateCertificate(bisCheck2);
        	diameter++;
    	}
		}
		catch(FileNotFoundException e){
			System.out.println("Ring does not exist: certificate missing");
		}
		catch(Exception e){
			System.out.println("Something's gone wrong - unable to retrieve diameter");
			e.printStackTrace();
		}
    	
		return diameter;
	}