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 ?
Asked
Active
Viewed 51 times
0
-
1Are you looking to **encrypt** it or **encode** it? – Mureinik Jan 28 '14 at 08:10
-
A string can contain numbers? Also numbers are legal char's. Do you have some special reason to convert numerical characters to [a-z]? – awi Jan 28 '14 at 08:11
-
I'm looking for encryption but i want to be able to decrypt it later – Harel Levy Jan 28 '14 at 08:32
2 Answers
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