Code example for SecureRandom

Methods: generateSeed

0
     
    /** 
     * Creates a 128-bit random string. 
     */ 
    public String generateRandomString() {
		SecureRandom random = new SecureRandom();
		byte[] randomBytes = random.generateSeed( 16 );
		String randomString = new String( Hex.encodeHex( randomBytes ) );
		return randomString;
	}      
 
    private String getEndpointDomainName( String endpoint ) {
    	int startIndex = 0;
    	int endIndex = 0;
    	 
    	if ( endpoint.startsWith( "http://") || endpoint.startsWith( "https://") ) {
    		startIndex = endpoint.indexOf( "://" ) + 3;
    	} 
    	else { 
    		startIndex = 0;
    	}