The Number Compactor

The number compactor is used for shrinking large numbers such as 1,573,495 and making 1.5 M.

Compacting Numbers

When you use the number compactor, you pass in a variable and you use the method, NumberCompactor.compact(); Say I wanted to compact Main.clicks so I can use it on a state without it taking up the whole screen full of numbers. I would type,

g.drawString(NumberCompactor.compact(Main.clicks) + " Clicks"), x, y);

If I wanted to get a little more advanced I could do,

g.drawString(NumberCompactor.compact(Main.clicks) + " " + PluralUtil.fromNumber(Main.clicks, "Click"), x, y);

to see if the word clicks should be modified (Tutorial here).

What Numbers Will Look Like

If your number is more than a thousand, there will be a K at the end like 12 K.
If your number is more than a million, there will be a M at the end like 2 M.
If your number is more than a billion there will be a M at the end like 34 B.
If your number is more than a trillion, there will be a M at the end like 16 T.