### Question:
UUIDGenerator { public static byte[] createType1() { if (type1Initialized == false) { initializeForType1(); } byte[] uuid = new byte[16]; System.arraycopy(IP, 0, uuid, 10, IP.length); long now = 0; synchronized (UUIDGenerator.class) { now = getTime(); uuid[IDX_TIME_SEQ] = (byte) ((_seq & 0x3F00) >>> 8); uuid[IDX_VARIATION] |= 0x80; uuid[IDX_TIME_SEQ+1] = (byte) (_seq & 0xFF); } byte[] timeBytes = Bytes.toBytes(now); System.arraycopy(timeBytes, TS_TIME_LO_IDX, uuid, IDX_TIME_LO, TS_TIME_LO_LEN); System.arraycopy(timeBytes, TS_TIME_MID_IDX, uuid, IDX_TIME_MID, TS_TIME_MID_LEN); System.arraycopy(timeBytes, TS_TIME_HI_IDX, uuid, IDX_TIME_HI, TS_TIME_HI_LEN); uuid[IDX_TYPE] |= TYPE_TIME_BASED; return uuid; }  static byte[] next(int type); static byte[] createType1(); static String nextString(int type); static String nextHex(int type); static final int TYPE1; static final int TYPE4; }### Answer:
@Test public void testInitType1MultiThreaded() throws Exception { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { Class uuid = UUIDGenerator.class; Field[] fields = uuid.getDeclaredFields(); for (Field f : fields) { if (f.getName().equals("type1Initialized")) { f.setAccessible(true); f.set(null, false); } else if (f.getName().equals("IP") || f.getName().equals("RANDOM")) { f.setAccessible(true); f.set(null, null); } } Thread t = new Thread() { @Override public void run() { UUIDGenerator.createType1(); } }; t.start(); UUIDGenerator.createType1(); return null; } }); }