return gcd(b, a % b);
}
+
+ private static int uidCounter = (int)(Math.random() * 0xffffffff);
+ /**
+ * Generates a unique 64-bit identifier.
+ */
+ public static long getUID()
+ {
+ long uid = 0L;
+ uid |= ((System.currentTimeMillis() >> 10) & 0xfffffffL) << 36;
+ uid |= (long)(Math.random() * 0xfL) << 32;
+ uid |= ++uidCounter & 0xffffffff;
+ return uid;
+ }
}