String back to byte[]
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   eddie_aks
Posted On:   Friday, April 19, 2002 01:45 AM

hi experts, l'm encrypting the String to Byte[] and store the byte to string variable as follow. how can i get back the exact byte[] from String variable?



byte[] bt = "123".getBytes(); //assume bt = [@1234

String s = bt.toString; //now s is "[@1234"



byte[] bt_test = s.getBytes() //bt_test now is [@124cdf(example). this is not what i wants, i wanted it back to the first line byte[] variable value which is [@1234

Re: String back to byte[]

Posted By:   Krzysztof_Raciniewski  
Posted On:   Friday, April 19, 2002 02:43 AM

You can use constructor with byte array.

byte[] b = "123".getBytes();
String s = new String(b);
About | Sitemap | Contact