Switch to full style
General Java code examples
Post a reply

Generate Unique Id As String

Tue Apr 23, 2013 9:15 pm

Generate Unique Id As String. Do not depend on time or MAC address (important for security).
java code
import java.util.UUID;



public class UIDGenerator {


public static String generateUID() {
return UUID.randomUUID().toString();
}


public static String generateC16UID() {

String C36UUID = UUID.randomUUID().toString();

String C16 = C36UUID.replaceAll("-", "");

return C16.substring(0, 16);
}
}




Post a reply
  Related Posts  to : Generate Unique Id As String
 generate password using php     -  
 How to generate dynamic 3d pie chart in php???     -  
 Unique Row Count Across Columns     -  
 How to generate ALT+ENTER in java?     -  
 check if string ends with specific sub-string in php     -  
 check if string start with a specific sub-string in PHP     -  
 Splitting a String Based on a Found String     -  
 recursive string reversal- reverse string     -  
 String token for string split     -  

Topic Tags

Java Strings