Ideally, we would like to take a long(System.currentTimeMillis in java) plus a postfix long as well and convert it to a set of characters+numbers in a much shorter string. We only want uppercase letters used. Is there a library for this already as it would seem like a very re-usable library for generating keys that users can type in easier as they are shorter.
I guess I could always write one but it would be nice to easily just grab someone else’s code/library.
example
- 0 = 0
- 1 = 1
- 2 = 2
- the rest digits
- 11 = A
- 12 = B
- 13 = C
so I can take a number and reduce the number of digits quite significantly.
thanks,
Dean
Simply use this:
To convert it back, use:
The 36 refers to the radix (10 digits + 26 characters).
JavaDoc references:
Long.toString(long, int);Long.parseLong(String, int);