Number Style

I have worked on a couple projects that involved building page numbers. As part of another side project I created a Java class for converting numbers to Roman numeral format, as well as English and data sizes. This class can be used for page numbers, or for an outline. I figured since it is just lying around on my hard disk, it would make it available on GitHub for people to do what they will.

With this class you can convert 6 to 'F' the sixth letter, or to 'vi' the lower case roman equivalent, or to 'six' the English equivalent. Conversions for numbers over 26 result in two letter combinations, so 27 is converted to 'AA' or 'aa' and there is a hard limit of 4000 for Roman numerals.

Below are a few examples of various formats.

value - TEXT - text - ROMAN - roman - english

6 - F - f - VI - vi - six

78 - BZ - bz - LXXVIII - lxxviii - seventy eight

350 - ML - ml - CCCL - cccl - three hundred fifty

1,564 - BHD - bhd - MDLXIV - mdlxiv - one thousand, five hundred sixty four

The class can also be used to compute numbers as sizes. For example:

33,051,900 - 31.521MB

1,310,861,241 - 1.221GB

GitHub Repository