i want to represent a long value (such as System.currentTimeInMillis() ) in a shorter form. and i'm thinking i can use bit manipulation here, but i'm stuck. i'm not really good at bit ops.
if long value is 1388534400000, how can i represent this as a String but in a shorter form in length?
basically i'd like to write two methods, one to encode and one to decode. so that given a shortened value, i'd like to be able to covert it back to original long value and vice versa.
------- UPDATE -----------
my question was very vague and i'm sorry for the confusion. here's my another attempt at better explanation of what i'm trying to achieve. (also i'll try to simplify my question. let's not think about saving space or persisting to DB).
let's say i have a long value which is a timestamp in milliseconds such as 1388534400123 which is a part of longer string that contains other fixed length numeric values such as (for simplicity) 999913885344001238888. in this case, i've padded with 9999 and 8888. now i have this as a String, but i need a shorter representation that does not lose any of original data (e.g., i want 9999, 1388534400123, and 8888). since these are all numbers, i was vaguely thinking i can use bits to shorten the representation. is there any way?