Hi I am new to using jsr 363 to do a unit conversion application. Can anyone help me to do the conversion between mile and km using jsr 363 library(uni-api)
Asked
Active
Viewed 272 times
1 Answers
1
It's done like this:
Quantity<Length> len = Quantities.getQuantity(10, MetricPrefix.KILO(Units.METRE));
Quantity<Length> mile = len.to(USCustomary.MILE);
You'll find examples for using the Common systems (including USCustomary) under https://github.com/unitsofmeasurement/uom-demos/tree/master/console/systems/common
Cheers, Werner

Werner Keil
- 592
- 5
- 12