cancel
Showing results for 
Search instead for 
Did you mean: 

Converting byte array to string

Former Member
0 Kudos

Hi

Bapi is returning a byte array.I want to pass this value to another bapi which accepts string as parameter how to convert byte array to string ? and also i want to display the actual value stored in byte array.How to do this?

regards

suresh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Suresh,

I don't think you can convert a byte array to string as such. But you can create a new string from a byte array as :

byte b[] = new byte[n];

.

populate the byte array

.

String str = new String(b);

<b>also i want to display the actual value stored in byte array</b>

Can you make your questin more clear? In what format do you want to display the data?

Best Regards,

Nibu.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use new String(the byte value,"UTF-8");

and use this string for the next bapi as input !

Regards

Bharathwaj

Former Member
0 Kudos

Hi Suresh,

Follow what is suggested by Nibu.

You can also display then this string as your binary data. It will show correct data.

Regards,

Bhavik