You can use System.out.format()

Example:

String project = "myProjectName";
String firstName = "firstName";
String lastName = "lastName";

System.out.format("%-20s%-15s%-15s", project, firstName, lastName);

Above code snippet should print the following formatted output:

myProjectName       firstName      lastName  

Edit:
I found this library which simplifies such kind of formatting. It is also available on Maven.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *