Meaningless Drivel is fun!*
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 Java 8 in Action this week in the Java 8 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
 
Similar Threads
trouble retrieving html of all web sites
Byte to String problem
Large File Upload
File encryption / decryption retaining line feeds
byte-string-byte convertion