Converting a string to byte[] such that the contents remain same
<p>I have a String say <code>String a = "abc";</code>. Now I want to convert it into a byte array say <code>byte b[];</code>, so that when I print <code>b</code> it should show "abc".</p>

<p>How can I do that?
<code>getBytes()</code> method is giving different result.</p>

<p>My program looks like that so far:</p>

<pre><code>String a="abc";
byte b[]=a.getBytes();
</code></pre>

<p>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. </p>
