Possible Duplicate:
How can I pad a String in Java?
I have a stuation in which my method1() return the string of various size and I want to display the string in a fix space (say length 50 character) I can use String.substring() if the length is greater than 50 character but not sure what to do if the string length is less than 50 character , how can I achieve that ?
for example my method1() return (in different call) :
John
Michael
J
Ab
While method2() return :
first
Second
Third
and I want to print the result like
John First
Michael Second
J Third
Ab Forth
I don't want to use any other character except space.