public static interface TypedUnit.UnitSelector<U extends TypedUnit<U>>
Modifier and Type | Method and Description |
---|---|
U |
getLargestExactUnit(ITypedQuantity<U> quantity)
Get the largest unit, if any, in which this quantity can be expressed exactly, typically
with an integer.
|
U |
getPreferredUnit(ITypedQuantity<U> quantity,
double minNumericalValue,
double maxNumericalValue) |
U getPreferredUnit(ITypedQuantity<U> quantity, double minNumericalValue, double maxNumericalValue)
U getLargestExactUnit(ITypedQuantity<U> quantity)
IQuantity.doubleValue()
== 0.0
), quantity.getUnit()
will be returned. Thus, if you want to find out a maximum common unit
for a set of quantities (not recommended), only use the non-zero quantities.
Note that this may be a fairly expensive operation, and isn't intended to be used excessively. The only valid use case is for guessing the original unit in which a quantity was expressed, after it has been stored or transmitted using a legacy mechanism with a fixed unit.
null