Here you can find the source of generateUniqueIdentity()
public static String generateUniqueIdentity()
//package com.java2s; /*/*from w w w . j av a2 s. co m*/ * Copyright 2008-2011 Follett Software Company * * This file is part of PerfMon4j(tm). * * Perfmon4j is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License, version 3, * as published by the Free Software Foundation. This program is distributed * WITHOUT ANY WARRANTY OF ANY KIND, WITHOUT AN IMPLIED WARRANTY OF MERCHANTIBILITY, * OR FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of the GNU Lesser General Public * License, Version 3, along with this program. If not, you can obtain the LGPL v.s at * http://www.gnu.org/licenses/ * * perfmon4j@fsc.follett.com * David Deuchert * Follett Software Company * 1391 Corporate Drive * McHenry, IL 60050 * */ import java.util.Random; public class Main { private final static String IDENTITY_CHARS = "BCDFGHJKLMNPRSTVWXYZ"; private final static Random random = new Random(); public static String generateUniqueIdentity() { StringBuilder builder = new StringBuilder(); for (int j = 0; j < 2; j++) { for (int i = 0; i < 4; i++) { builder.append(nextChar()); } if (j == 0) { builder.append('-'); } } return builder.toString(); } private static char nextChar() { int offset = random.nextInt(IDENTITY_CHARS.length()); return IDENTITY_CHARS.charAt(offset); } }