Possible Duplicate:
How to go about formatting 1200 to 1.2k in java
When displaying a number I would like to automatically adjust the units to limit the size of numbers. For instance if working with meters and a number like 22000 then I would like to display 22 km, but if the number is 22 then I would just display 22 m.
It seems like java.text.NumberFormat
could be extended to add units. If so, can you clarify how the api is used (I've RTFM). If not, is there another java api you would suggest?
Further context. I'm working within JFreeChart and was led to NumberFormat from its API