Class Format

java.lang.Object
org.djunits.value.formatter.Format

public final class Format extends Object
Format a floating point number in a reasonable way.
I've experienced problems with the %g conversions that caused array bounds violations. Those versions of the JRE that do not throw such Exceptions use one digit less than specified in the %g conversions.
TODO check how to always format numbers corresponding to the Locale used.

Copyright (c) 2015-2024 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
  • Field Details

    • DEFAULTSIZE

      public static final int DEFAULTSIZE
      Default total width of formatted value.
      See Also:
  • Method Details

    • format

      public static String format(double value)
      Format a floating point value.
      Parameters:
      value - double; the value to format
      Returns:
      String; the formatted floating point value