I have a String say String a = "abc";
. Now I want to convert it into a byte array say byte b[];
, so that when I print b
it should show "abc".
How can I do that?
getBytes()
method is giving different result.
My program looks like that so far:
String a="abc";
byte b[]=a.getBytes();
what I want is I have two methods made in a class one is public byte[] encrypt(String a) and another is public String decrypt(byte[] b) after doing encryption i saved the data into database but when i am getting it back then byte methods are not giving the correct output but i got the same data using String method but now I have to pass it into decrypt(byte[] b) How to do it this is the real scenario.