Class DecimalFormatter


  • public class DecimalFormatter
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toExponential​(double v, int fractionDigits)
      The algorithm of Number.prototype.toExponential.
      static java.lang.String toFixed​(double v, int fractionDigits)
      The algorithm of Number.prototype.toFixed(fractionDigits).
      static java.lang.String toPrecision​(double v, int precision)
      The algorithm of Number.prototype.toPrecision()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DecimalFormatter

        public DecimalFormatter()
    • Method Detail

      • toExponential

        public static java.lang.String toExponential​(double v,
                                                     int fractionDigits)
        The algorithm of Number.prototype.toExponential. If fractionDigits is < 0, then it indicates the special case that the value was previously undefined, which calls for a different precision for the calculation.
      • toFixed

        public static java.lang.String toFixed​(double v,
                                               int fractionDigits)
        The algorithm of Number.prototype.toFixed(fractionDigits).
      • toPrecision

        public static java.lang.String toPrecision​(double v,
                                                   int precision)
        The algorithm of Number.prototype.toPrecision()