gnu.text
Class IntegerFormat
public class IntegerFormat
Handle formatting of integers.
Used to implement the Common Lisp ~D (Decimal), ~X (Hexadecimal),
~O (Octal), ~B (Binary), and ~R (Radix) Common Lisp formats operators.
String | convertToIntegerString(Object x, int radix)
|
int | format(Object arg, int start, Writer dst, FieldPosition fpos)
|
int | format(Object[] args, int start, Writer dst, FieldPosition fpos) - Format an array of arguments, and write out the result.
|
format , format , format , format , format , format , getParam , getParam , getParam , nextArg , parseObject , print , result , resultCode |
MIN_DIGITS
public static final int MIN_DIGITS
The minWidth is minimum number of digits, not minimum total width.
PAD_RIGHT
public static final int PAD_RIGHT
SHOW_BASE
public static final int SHOW_BASE
Add "0x" (hex) or "0" (octal) prefix.
SHOW_GROUPS
public static final int SHOW_GROUPS
Do groups (for example thousands, using commas).
SHOW_PLUS
public static final int SHOW_PLUS
If value is non-negative, emit a '+'.
SHOW_SPACE
public static final int SHOW_SPACE
If value is non-negative, emit an initial ' '.
UPPERCASE
public static final int UPPERCASE
commaChar
public int commaChar
commaInterval
public int commaInterval
minWidth
public int minWidth
Minimal width of the result, includiing sign, commas, etc.
However, if the MIN_DIGITS flag is given, it's the minimum number
of digits instead. This is used for printf-style "precision".
padChar
public int padChar
The padding characters, by default ' '.
IntegerFormat
public IntegerFormat()
convertToIntegerString
public String convertToIntegerString(Object x,
int radix)
format
public int format(Object arg,
int start,
Writer dst,
FieldPosition fpos)
throws java.io.IOException
- format in interface ReportFormat
format
public int format(Object[] args,
int start,
Writer dst,
FieldPosition fpos)
throws java.io.IOException
Format an array of arguments, and write out the result.
- format in interface ReportFormat
args
- the objects to be formattedstart
- the index (in args) of the argument to start withdst
- where to write the result
- an integer result(resultCode, nextArg), where
nextArg is the index following the last argument processed, and
code is a result code (normally 0, or negative if early termintation)