move formatInteger() to its own source file, and add examples