This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes formatting output in printstream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "formatting output in printstream" Watch "formatting output in printstream" New topic

formatting output in printstream

subhajit paul

Joined: Dec 17, 2008
Posts: 17
hi all,

lets say i have a byte array declared as:

when i use

i get an output like: 2a a

can anyone suggest how to format my output as : 2a 0a

and when line 2 is changed to :

when i get an output like: 2a a?

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45292
It's in the Java Tutorials. Look half-way down the page.
It is sorta covered in the JavaRanch Style Guide.
subject: formatting output in printstream
It's not a secret anymore!