FileDocCategorySizeDatePackage
UUIDGenerator.javaAPI DocAzureus 3.0.3.41937Tue Mar 28 13:31:30 BST 2006com.aelitis.azureus.core.util

UUIDGenerator

public class UUIDGenerator extends Object

Fields Summary
private static Random
random
Constructors Summary
Methods Summary
public static synchronized byte[]generateUUID()
128 bit UUID using random method

return

	
		       		 
	
	   
	
	
		byte[]	bytes = new byte[16];
		
		random.nextBytes( bytes );
		
		return( bytes );
	
public static java.lang.StringgenerateUUIDString()
129 byte random UUID formatted as standard 36 char hex and hyphen string

return

		byte[]	bytes = generateUUID();
		
		String	res = ByteFormatter.encodeString( bytes ).toLowerCase();
		
		return( res.substring(0,8) + "-" + res.substring(8,12) +
				"-" + res.substring(12,16) + "-" + res.substring(16,20) + "-" + res.substring( 20 ));
	
public static voidmain(java.lang.String[] args)

		for (int i=0;i<100;i++){
			System.out.println( generateUUIDString());
		}