0

I'm trying to represent numbers to a String and backwards. For instance if i have the number 64568899. I want to represent it in a way i could decrypt it later but i need to write it as String or chars but not as a number. Any ideas ?

2 Answers2

0

You can represent any binary data to string using base64 string. Base64 Encoding in Java

With doubles you might just need String.valueOf(double).

Community
  • 1
  • 1
Reinstate Monica
  • 2,767
  • 3
  • 31
  • 40
0

If you only want to convert your number into a String, just use the valueOf method of String class:

String val = String.valueOf(number);

For converting Strings to Numbers use the valueOf methods of Integer, Double or Float (depends on which numbers you will have):

Integer val = Integer.valueOf(stringValue);
bobbel
  • 3,327
  • 2
  • 26
  • 43