Roman Numerals library for Java

If you need to convert numbers to Roman Numerals, or Roman Numerals to numbers, then this library is for you.

Features

Maven Setup

To use the Roman Numerals library in your Maven project, simply add the dependency and repository to your POM:
  <dependencies>
    <dependency>
      <groupId>com.frequal.romannumerals</groupId>
      <artifactId>roman-numerals</artifactId>
      <version>1.3</version>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <id>frequal.com</id>
      <url>http://frequal.com/maven-repository</url>
    </repository>
  </repositories>

Download

API Examples

        converter = new Converter();

        // Convert Roman numerals to numbers
	int convertedNumber = converter.toNumber("IV"));

        // Convert numbers to Roman numerals
        String romanNumerals = converter.toRomanNumerals(1999));
	
        // Strict mode throws ParseExceptions on illegal numerals
        strictConverter = new Converter(true);
        strictConverter.toNumber("IM");

Command-line Examples

> java -jar roman-numerals-1.3.jar 3888
3888 in Roman numerals: MMMDCCCLXXXVIII
> java -jar roman-numerals-1.3.jar 6
6 in Roman numerals: VI
> java -jar roman-numerals-1.3.jar 9
9 in Roman numerals: IX
> java -jar roman-numerals-1.3.jar IX
IX as a number: 9
> java -jar roman-numerals-1.3.jar MMIV
MMIV as a number: 2004

Upcoming Features


Last modified on 23 Feb 2013 by AO

Copyright © 2016 Andrew Oliver