您好,我是使用 jsr 363 来做单位转换应用程序的新手。谁能帮我使用 jsr 363 库(uni-api)进行英里和公里之间的转换
最佳答案
它是这样完成的:
Quantity<Length> len = Quantities.getQuantity(10, MetricPrefix.KILO(Units.METRE));
Quantity<Length> mile = len.to(USCustomary.MILE);
您可以在 https://github.com/unitsofmeasurement/uom-demos/tree/master/console/systems/common 下找到使用通用系统(包括 USCustomary)的示例。
干杯, 维尔纳
关于jsr363 - 使用 jsr 363 库在英里和公里之间进行单位转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37723490/