permaculture playing cards*
The moose likes Java in General and the fly likes byte or char into String? 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 » Java in General
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: 14687
    
  16

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: byte or char into String?