Package PamUtils

Class SIUnitFormat

java.lang.Object
PamUtils.SIUnitFormat

public class SIUnitFormat extends Object
Class to format SI units adding appropriate millis, micros, kilos, etc.
Author:
Doug Gillespie
  • Constructor Details

    • SIUnitFormat

      public SIUnitFormat()
  • Method Details

    • formatValue

      public static String formatValue(double value, String baseUnit)
      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

      public static String formatRange(double[] value, String baseUnit)
      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