Neat, readable output formatted into columns is an important part of our programming.
Method One
Up to this point the escape character “\t” has been offered as a means of arranging your work in columns. Only works if the data in the fields is more or less the same length.
Mothod Two
A public method that adds spaces to short words so that each column is the same width. You need to call the method each time you want to use it.
NOTE: Remember to edit the package
Click here to download the method
Method Three
Using String.format
Eg
“%-13s” – left aligned, column of 13, datatype is String
“%8b” – right aligned, column of 8, datatype is boolean
“%10d” – right aligned, column of 10, datatype is number (int, double etc)