All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.jpattern.shared.util.UniqueId Maven / Gradle / Ivy

The newest version!
package com.googlecode.jpattern.shared.util;


import java.util.Random;

/**
 * 
 * @author Francesco Cina'
 *
 * 12/ago/2010
 */
public abstract class UniqueId {
    private static long currentA = System.currentTimeMillis();
    private static Random random = new Random();

    public static synchronized String get() {
        StringBuffer rit = new StringBuffer();
        currentA++;
        rit.append(random.nextLong());
        rit.append(currentA);
        rit.append(random.nextLong());

        return rit.toString().replaceAll("-", "");
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy