Thursday, October 4, 2012

Random String (ID) generate in JAVA

java.util.UUID package contains random String generation feature.

Refer below code.

UUID uuid = UUID.randomUUID();
uuid.toString();

Generated Strings

a5b74c68-41de-4605-affb-882e97e33779
8d615a58-8899-4d94-9bf0-b79e411d06b6