Read the API for String#format(...) and PrintStream#printf(...). And you'll want to to get the details of formats from Formatter.

db