Class DoubleToStringFormatter


  • public class DoubleToStringFormatter
    extends Object
    • 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)
        Parameters:
        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 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.
        Parameters:
        d -
        Returns:
        String representation of this double