jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Reversible String to Number convertor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Reversible String to Number convertor" Watch "Reversible String to Number convertor" New topic

Reversible String to Number convertor

Vijay Kashyap
Ranch Hand

Joined: Jul 30, 2001
Posts: 74

I have a requirement for generating reversible String to Number Conversion utility. Can somebody supply me the pointers to go about bulding this.

I am stating an example to clarify the need:

For input String 'Java Ranch' I need to generate a unique number which should be able to convert back to 'Java Ranch' string.

Arun Bommannavar
Ranch Hand

Joined: Jan 11, 2003
Posts: 53
My guess would be HashMap.

Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Well, it all depends on how much you would like to complicate it. One simple way would be to get bytes from the String and convert them to a number, and then conver the number back to bytes and get the String, provided that you can use the same encoding for both operations all the time.

Anohter way could be encryption. See Java Almanac for an example.
I agree. Here's the link: http://aspose.com/file-tools
subject: Reversible String to Number convertor
It's not a secret anymore!