0

I have a string which contains elements of byte array such as "[B@42b19e58" which I have to convert back into the byte array.

Can someone please suggest me a method to do so?

Here, I don't have to convert a string to byte array. I already have byte array elements in the string, I just have to put them back to the array.

3
  • This depends on how you encoded your byte array as a string. Commented Jan 16, 2018 at 12:00
  • @KevinRobatel I don't have to convert a string to byte array. Read the question again before commenting. Commented Jan 16, 2018 at 12:04
  • How did the byte array get into the string? Show us this part of the code. Commented Jan 16, 2018 at 12:28

1 Answer 1

0

Use this code

String str= "Convert Java String";
byte[] byteArray = str.getBytes();
Sign up to request clarification or add additional context in comments.

1 Comment

I already have byte array element in a string. I just have to put it back to put them back to array.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.