The format() is partly implemented in this patch, the integer/float/data format feature is not included because this patch is not small already. I'll attach the features left if this one is acceptted.
There are some tests fail on RI, and I consider they are RI's bugs, as below:
FomatterTest.test_formatLjava_lang_String$Ljava_lang_Object_Percent(), Line1062: error on RI, specification says FormatFlagsConversionMismatchException should be thrown but RI throw IllegalFormatFlagsException.
FomatterTest.test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversion(), Line1257: fail on RI. Spec says that If the '#' flag is present and the argument is not a Formattable , then a FormatFlagsConversionMismatchException should be thrown, but RI doesn't.
FormatterTest.test_formatLjava_lang_String$Ljava_lang_Object_CharacterConversion(),Line1328 and 1333: error on RI, RI does not support converter 'C' and throws UnknownFormatConversionException.
Please try this patch, thanks a lot.