This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes byte[] to string - Not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "byte[] to string - Not working" Watch "byte[] to string - Not working" New topic
Author

byte[] to string - Not working

Johannes Thorén
Ranch Hand

Joined: Nov 18, 2008
Posts: 64
For some reason my byte[].toString() does not result in a string that represents the content of the byte array. I got this code:


I get this as output: [B@1732a4df


But when i do this, it works:

I get this output: start_game


This is the code that creates msg:


Does anyone know why my byte array does not result in the string "start_game" when converting with toString() ?
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
Dupliacate post! I answered this question yesterday.

change line 3 of your first code to



Johannes Thorén, you aren't concentrating.
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
Same question was answered yesterday
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: byte[] to string - Not working