bitcoinj/bitcoinj — pull request #112 by mackler (2014-06-20 18:50:17+00:00)
Title: Locale-sensitive, self-denominating Bitcoin value formatter/parser

I had created this class for myself, but with just a bit of modification it seems worth sharing. If you fancy making it part of bitcoinj, you're welcome to it. If not, no hard feelings.

There is javadoc documentation in the comments, but briefly, while it overlaps partially with the `CoinFormat` class, the major differences are:

3. When formatting, it adjusts the denominational units so as to minimize the number of zeros in the formatted number and adds a currency symbol or code to indicate the units;
2. The number formatting and placement of the currency symbol/code is locale sensitive; and
1. It extends the `java.text.Format` class, which allows for the type of examination and manipulation of the different fields in the format--such as integer, fraction and decimal separator--that is necessary if you need to do things such as aligning a list of numbers vertically.