View Javadoc
1   package org.djunits.value.formatter;
2   
3   /**
4    * Format a floating point number in a reasonable way. <br>
5    * I've experienced problems with the %g conversions that caused array bounds violations. Those versions of the JRE that do
6    * <b>not</b> throw such Exceptions use one digit less than specified in the %g conversions. <br >
7    * TODO check how to always format numbers corresponding to the Locale used.
8    * <p>
9    * This file was generated by the djunits value classes generator, 26 jun, 2015
10   * <p>
11   * Copyright (c) 2015-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
13   * <p>
14   * $LastChangedDate: 2018-01-28 03:17:44 +0100 (Sun, 28 Jan 2018) $, @version $Revision: 256 $, by $Author: averbraeck $,
15   * initial version 26 jun, 2015 <br>
16   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
17   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
18   */
19  public final class Format
20  {
21      /**
22       * This class shall never be instantiated.
23       */
24      private Format()
25      {
26          // Prevent instantiation of this class
27      }
28  
29      /** Default total width of formatted value. */
30      public static final int DEFAULTSIZE = 10;
31  
32      /**
33       * Format a floating point value.
34       * @param value double; the value to format
35       * @return String; the formatted floating point value
36       */
37      public static String format(final double value)
38      {
39          return EngineeringFormatter.format(value, DEFAULTSIZE);
40      }
41  
42  }