Class DoubleToStringFormatter

  • public class DoubleToStringFormatter
    extends java.lang.Object
    • Field Summary

      Modifier and Type Field Description
      static char[] INFINITY  
      static char[] NaN  
      static char[][] ZEROS  
    • Constructor Summary

      Constructor Description
      DoubleToStringFormatter​(int numDigits, char decimalPoint, char negativePrefix, boolean limitMaxFracDigits)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String appendFormatted​(double d)
      Returns string representation of double.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INFINITY

        public static final char[] INFINITY
      • NaN

        public static final char[] NaN
      • ZEROS

        public static final char[][] ZEROS
    • Constructor Detail

      • DoubleToStringFormatter

        public DoubleToStringFormatter​(int numDigits,
                                       char decimalPoint,
                                       char negativePrefix,
                                       boolean limitMaxFracDigits)
        numDigits - If number of decimal places before decimal points 'x' is less than numDigits then number of places after decimal places should be less that equal than numDigits - x
        decimalPoint - Char which represents decimal point. (for US locale it is .)
        negativePrefix - Char representing prefix for negative numbers (for US locale it is -)
        limitMaxFracDigits - If set as true numDigits will be max number of digits allowed after decimal places.
    • Method Detail

      • appendFormatted

        public java.lang.String appendFormatted​(double d)
        Returns string representation of double. This method returns null in cases where the Java's string representation of this double is not same as that returned by this formatter. In those cases callers of this method should handle number to string conversion themselves.
        d -
        String representation of this double