I would request you to learn the Formatter classs API first.
Here is your code:
Now %b or %B is the formatted output for boolean ok....This will return null if the argument is null else if the argument is Boolean it will return String.valueOf() else it will return true. This is the algorithm for boolean.
%f is the formatted output for floating point literals and not floats or doubles but both(as far as I know) so it gives the correct output.
%s refers String. If argument is null then it returns null else if argument (class of the argument) implements Formattable interface then arg.formatTo() is invoked else arg.toString() is invoked. arg is the argument in question.
Online reference: Formatter Class API Don't get confused Formatter class's format uses the same thing as System.out.printf() method. You can learn the API here.
I hope it answers your question.
Joined: Jan 27, 2006
This was really helpful. I compiled and ran as per the API doc for the class Formatter. It seems to work fine.