Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何将千克、克转换为千克转换器并获得以克为单位的结果(例如 5 千克 500 克 = 5500 克)
如何使用 javax.measure.* 执行此操作请参阅此处
注意:我只需要基于上述软件包的解决方案,而不是一些通用的解决方案
这是一个相当繁琐的 API,但是像这样呢?
int grams = Measure.valueOf(5, SI.KILOGRAM).intValue(SI.GRAM) + Measure.valueOf(500, SI.GRAM).intValue(SI.GRAM);
可能有一种更正式的Measure值算术方法,但我找不到。
Measure