Created
March 5, 2019 14:09
-
-
Save kmila/07a732ea08af45ca70b1bf4af165b2c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UUID sequentialId(int id) { | |
Assert.isTrue(id >= 0, "[Assertion failed] - negative id"); | |
return UUID.fromString(String.format("%08d-%04d-%04d-%04d-%012d", Math.min(id, 99999999), 0, 0, 0, 0)); | |
} | |
public static String asString(UUID uuid) { | |
return String.format("%016x", uuid.getMostSignificantBits()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment