Java examples for java.util:UUID
An unique string of 16 characters.
//package com.java2s; import java.util.UUID; public class Main { public static void main(String[] argv) throws Exception { System.out.println(uniqueString()); }/*w ww .ja v a 2 s . co m*/ /** * An unique string of 16 characters. * * @return unique string */ public static String uniqueString() { String random = UUID.randomUUID().toString(); random = random.replaceAll("-", ""); random = random.substring(0, 16); return random; } }