A Java implementation of the Segment's KSUID library. For a full treatment of why this came about, you can read the blog post on their website.
This library can be downloaded from Maven Central by adding the following as a dependency in your pom.xml file:
<dependency>
<groupId>com.amirkhawaja</groupId>
<artifactId>ksuid</artifactId>
<version>1.0.0</version>
</dependency>
final Ksuid ksuid = new Ksuid();
final String uid = ksuid.generate();
// e.g. output: Be785NYYxP29BJiAJPupfsXuGpR
final String decoded = ksuid.parse(uid);
// e.g. output: Time: 2017-07-08T21:13:08Z[UTC]
// Timestamp: 1499548388
// Payload: [-42, 24, -60, -3, -66, 38, 32, 9, 62, -22, 95, -79, 123, -122, -91, 0]