How to format text correctly using printf() (Java)
Clash Royale CLAN TAG #URR8PPP How to format text correctly using printf() (Java) Hello I want to print something so they are aligned. for (int i = 0; i < temp.size(); i++) { //creatureT += "[" + temp.get(i).getCreatureType() + "]"; creatureS = "t" + temp.get(i).getName(); creatureT = " [" + temp.get(i).getCreatureType() + "]"; System.out.printf(creatureS + "%15a",creatureT + "n"); } and the output is Lily [Animal] Mary [NPC] Peter [Animal] Squash [PC] I just want the [Animal], [NPC], and [PC] to be aligned like Lily [Animal] Mary [NPC] Peter [Animal] Squash [PC] Say I know that no name will be greater then 15 characters. surely some of your past responses helped you. Why not accept some of them? It would show that you appreciate the time and effort put into trying to help...