Class HexNumberFormat

    • Constructor Detail

      • HexNumberFormat

        public HexNumberFormat()
        Creates a new instance with 8 digits.
      • HexNumberFormat

        public HexNumberFormat​(int digits)
        Creates a new instance with the specified number of digits.
        Parameters:
        digits - the digits.
    • Method Detail

      • getNumberOfDigits

        public final int getNumberOfDigits()
        Returns the number of digits.
        Returns:
        The number of digits.
      • setNumberOfDigits

        public void setNumberOfDigits​(int digits)
        Sets the number of digits.
        Parameters:
        digits - the number of digits.
      • format

        public StringBuffer format​(double number,
                                   StringBuffer toAppendTo,
                                   FieldPosition pos)
        Formats the specified number as a hexadecimal string. The decimal fraction is ignored.
        Specified by:
        format in class NumberFormat
        Parameters:
        number - the number to format.
        toAppendTo - the buffer to append to (ignored here).
        pos - the field position (ignored here).
        Returns:
        The string buffer.
      • format

        public StringBuffer format​(long number,
                                   StringBuffer toAppendTo,
                                   FieldPosition pos)
        Formats the specified number as a hexadecimal string. The decimal fraction is ignored.
        Specified by:
        format in class NumberFormat
        Parameters:
        number - the number to format.
        toAppendTo - the buffer to append to (ignored here).
        pos - the field position (ignored here).
        Returns:
        The string buffer.
      • parse

        public Number parse​(String source,
                            ParsePosition parsePosition)
        Parsing is not implemented, so this method always returns null.
        Specified by:
        parse in class NumberFormat
        Parameters:
        source - ignored.
        parsePosition - ignored.
        Returns:
        Always null.