It just takes the variables hour, minute, and second and bring it the the format 05:23:42. Maybe another example would be this:
String s = String.format("Hello %s answered your question", "placeofm");
When you print the string to show it in the console it would look like this
System.out.println(s);
Hello placeofm answered your question
The placeholder %02d is for a decimal number with two digits. %s is for a String like my name in the sample above. If you want to learn Java you have to read the docs. Here it is for the String class. You can find the format method with a nice explanation. To read this docs is really important not even in Java.