@InterfaceAudience.Private @InterfaceStability.Unstable public class UnitsConversionUtil extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | UnitsConversionUtil.ConverterHelper class for encapsulating conversion values. | 
| Modifier and Type | Field and Description | 
|---|---|
| static Set<String> | KNOWN_UNITS | 
| Constructor and Description | 
|---|
| UnitsConversionUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static int | compare(String unitA,
       long valueA,
       String unitB,
       long valueB)Compare a value in a given unit with a value in another unit. | 
| static int | compareUnits(String unitA,
            String unitB)Compare a unit to another unit. | 
| static long | convert(String fromUnit,
       String toUnit,
       long fromValue)Converts a value from one unit to another. | 
public static long convert(String fromUnit, String toUnit, long fromValue)
fromUnit - the unit of the from valuetoUnit - the target unitfromValue - the value you wish to convertpublic static int compare(String unitA, long valueA, String unitB, long valueB)
unitA - first unitvalueA - first valueunitB - second unitvalueB - second valuepublic static int compareUnits(String unitA, String unitB)
unitA - first unitunitB - second unitCopyright © 2008–2023 Apache Software Foundation. All rights reserved.