The moose likes Java in General and the fly likes byte or char into String? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "byte or char into String?" Watch "byte or char into String?" New topic
Author

byte or char into String?

Marko Debac
Ranch Hand

Joined: Aug 21, 2006
Posts: 121
Hi,

Is there posibility that I create put all this what are getting out with System.out.print((char)buf[i]) into one little String?


What is the good(best) way to transform?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

Did you consider using a StringBuffer ?


[My Blog]
All roads lead to JavaRanch
Bupjae Lee
Ranch Hand

Joined: May 14, 2007
Posts: 107
There are 3 options; each option has diffrerent result.

1) If you want to make 1-length String:


2) If you want to make maxinum-1024-length String block:


3) If you want to make whole result to one String:
Marko Debac
Ranch Hand

Joined: Aug 21, 2006
Posts: 121
Thank you guys
Marko
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: byte or char into String?
 
Similar Threads
quite small (make the changelog non-static, i.e. load its content from a file)
Getting a thread to run to completion
copying files
Bad Class Access Flags Alert
reading byte array