wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "byte[] to string - Not working" Watch "byte[] to string - Not working" New topic

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
Similar Threads
Large File Upload
Byte to String problem
File encryption / decryption retaining line feeds
trouble retrieving html of all web sites
byte-string-byte convertion