Package org.djunits.value.util
Class ValueUtil
- java.lang.Object
-
- org.djunits.value.util.ValueUtil
-
public final class ValueUtil extends Object
ValueUtil implements a couple of unit-related static methods.Copyright (c) 2015-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
expressAsSIUnit(double value, Unit<?> unit)
Convert a value in a given unit into the equivalent in the standard SI unit.static double
expressAsUnit(double siValue, Unit<?> targetUnit)
Convert a value from the standard SI unit into a compatible unit.
-
-
-
Method Detail
-
expressAsSIUnit
public static double expressAsSIUnit(double value, Unit<?> unit)
Convert a value in a given unit into the equivalent in the standard SI unit.- Parameters:
value
- double; the value to convert into the standard SI unitunit
- Unit<?>; the unit of the given value- Returns:
- double; the value in the standard SI unit
-
expressAsUnit
public static double expressAsUnit(double siValue, Unit<?> targetUnit)
Convert a value from the standard SI unit into a compatible unit.- Parameters:
siValue
- double; the given value in the standard SI unittargetUnit
- Unit<?>; the unit to convert the value into- Returns:
- double; the value in the targetUnit
-
-