COPY string value to byte [] in Java
I would like to COPY (not convert) the value of a string to a byte. The
string has been created through transformation of a byte value to base 36,
and then saved as a string.
i.e:
//-------------deconstruct -----------------
byte [] a = [B@7bb4568; // actual byte value
String b = a.toString(); // Copy byte value to a string
String[] parts = b.split("@") ; // split string b to @
String part_1 = parts[0]; // string with value [B
String part_2 = parts[1]; // string with value 7bb4568
//-------------reconstruct -----------------
String c
String pre_fix = "[B@"; // first part of the [B@7bb4568 byte value ,
saved as string
c = pre_fix + parts[1]; // join the two parts
So we have the two parts "reunited" and i want this string value to be
SAVED (and NOT to be converted) as a byte value!
Any ideas???
Thanks in advance!
No comments:
Post a Comment