Package PamUtils
Class SIUnitFormat
java.lang.Object
PamUtils.SIUnitFormat
Class to format SI units adding appropriate millis, micros, kilos, etc.
- Author:
- Doug Gillespie
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatRange
(double[] value, String baseUnit) Format a range of two values.static String
formatValue
(double value, String baseUnit) Format a value.
-
Constructor Details
-
SIUnitFormat
public SIUnitFormat()
-
-
Method Details
-
formatValue
Format a value. The value will be displayed to two decimal places and will be be displayed with two decimal places.- Parameters:
value
- SI value to format (not scaled, e.g. 65932.5)baseUnit
- unit (e.g. Hz)- Returns:
- Scaled and formated, e.g. 65.93kHz
-
formatRange
Format a range of two values. The value will be displayed to two decimal places and will be be displayed with two decimal places. Scale always decided by the second value- Parameters:
value
- SI value to format must be two element array (not scaled, e.g. {65932.5, 1299887.4)baseUnit
- unit (e.g. Hz)- Returns:
- Scaled and formated, e.g. .065-1.30MkHz
-