Here you can find the source of generateGUID()
public static String generateGUID()
//package com.java2s; //License from project: Apache License import java.util.UUID; public class Main { public static String generateGUID() { return replaceWithBlank(UUID.randomUUID().toString(), '-'); }/*from w ww .j a va2s .c o m*/ public static String replaceWithBlank(String value, char oldChar) { if (null == value || value.length() == 0) { return value; } int len = value.length(); int index = 0; char[] newValue = new char[len]; for (int i = 0; i < len; i++) { char currentChar = value.charAt(i); if (currentChar != oldChar) { newValue[index++] = currentChar; } } return new String(newValue, 0, index); } }