package com.mosty.common.util;

import java.util.UUID;

public class UUIDGenerator {

	/**
	 * 获取UUID
	 * @return
	 */
	public static String getUUID() {
		UUID uuid = UUID.randomUUID();
		String str = uuid.toString();
		// 去掉"-"符号
		str = str.replace("-", "");
		return str;
	}

	/**
	 * 获得指定数量的UUID
	 * @param number 指定数量
	 * @return
	 */
	public static String[] getUUID(int number) {
		if (number < 1) {
			return null;
		}
		String[] ss = new String[number];
		for (int i = 0; i < number; i++) {
			ss[i] = getUUID();
		}
		return ss;
	}

	public static void main(String[] args) {
		String[] ss = getUUID(10);
		for (int i = 0; i < ss.length; i++) {
			System.out.println("ss[" + i + "]=====" + getUUID());
		}
	}
}
