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