HI,
Can any one know how to convert byte array into char array.

For example :

byte buf[]=teststr.getBytes();

Note:
buf is byte array. I need to convert this into char array.

Why use getBytes? Why don't you use toCharArray? In any case, the easiest way (although not necessarily the most effecient) is to do new String(byte[]).toCharArray() .

HI,
I am retriveing Vector values using getBytes.

// Her teststr is Vector..... Using toCharArray() i cant retrive these values...... So any other option is there......
For example :

byte buf[]=teststr.getBytes();

Note:
buf is byte array. I need to convert this into char array.

What? What are you talking about? If you need these "bytes" as "chars" then do new String -> toCharArray There is no reason you cannot do that, unless those "bytes" do not represent characters (i.e. a String) and so "converting" them to chars would be pointless anyway.

I still have no idea what you mean by "Her teststr is Vector". Are you saying that this "byte buffer" is a serialised Vector object maybe? In which case this "conversion" is less than pointless anyway.

Hi,
I got the output for my project .... .... masijade thanks for your information friend......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.