Resistor color codes and calculations as a Java Maven library

Next step in my book progress, is getting more into the details of hardware components. And as always starting with the smallest most-used ones: resistors!
To be able to fully document this for the book and create a demo application, I started again with creating and sharing a Java library.

Maven repository

A first version is now available on Maven.

Source code

Similar to my other shared libraries, the sources are available on GitHub.

How to use

Resistor color coding

Available as ColorCode.BLACK, ColorCode.BROWN… and includes all values listed in this table:

ColorCode HEX color Value Multiplier Tolerance (%) Temp. coeff. (ppm/K)
BLACK #000000 0 250
BROWN #761d1d 1 10Ω 1.0 100
RED #cc0000 2 100Ω 2.0 50
ORANGE #ffa500 3 1KΩ 15
YELLOW #ffff00 4 10KΩ 0.0 25
GREEN #008000 5 100KΩ 0.5 20
BLUE #0000cc 6 1MΩ 0.25 10
VIOLET #ee82ee 7 10MΩ 0.1 5
GREY #808080 8 100MΩ 0.25 1
WHITE #ffffff 9 1GΩ 0.0
GOLD #ffd700 0.1Ω 5.0
SILVER #c0c0c0 0.01Ω 10.0
NONE 20.0

Calculate value of a resistor based on 3, 4, 5 or 6 ColorCodes

Example with 3 ColorCodes

ColorValue value3band = Calculate.resistorValue(
        Arrays.asList(ColorCode.ORANGE, ColorCode.ORANGE, ColorCode.BROWN)
);
System.out.println(Convert.toOhmString(value3band.getOhm()));           // Result: 330Ω
System.out.println(value3band.getTolerance() + "%");                    // Result: 20.0%

Example with 6 ColorCodes

ColorValue value6band = Calculate.resistorValue(
        Arrays.asList(
                ColorCode.ORANGE, ColorCode.WHITE, ColorCode.BLACK,
                ColorCode.SILVER, ColorCode.BROWN, ColorCode.RED
        )
);

System.out.println(Convert.toOhmString(value6band.getOhm()));           // Result: 3.9Ω
System.out.println(value6band.getTolerance() + "%");                    // Result: 1.0%
System.out.println(value6band.getTemperatureCoefficient() + "ppm/K");   // Result: 50ppm/K

Calculate required resistor value for a LED

// Calculate.resistorForLed(double sourceVoltage, double ledVoltage, double ledCurrent)
System.out.println(Calculate.resistorForLed(3.3, 2.2, 0.02));           // Result: 55Ω

Calculate total value for resistors in serial or parallel

// Calculate.serial(List<double> values) {
System.out.println(Calculate.serial(Arrays.asList(2D, 5D, 7D)));        // Result: 14Ω

// Calculate.parallel(List<double> values)
System.out.println(Calculate.parallel(Arrays.asList(10D, 2D, 1D)));     // Result: 0.625Ω