public class ScientificNumberFormatter extends NumberFormat
NumberFormat
which formats numbers in scientific notation
if they are outside the given range.NumberFormat.Field
FRACTION_FIELD, INTEGER_FIELD
Constructor and Description |
---|
ScientificNumberFormatter()
Creates a ScientificNumberFormatter instance with the default number of decimals, lower limit, and upper limit.
|
ScientificNumberFormatter(int numDecimals,
double lowerLimit,
double upperLimit)
Creates a ScientificNumberFormatter instance.
|
Modifier and Type | Method and Description |
---|---|
StringBuffer |
format(double number,
StringBuffer toAppendTo,
FieldPosition pos) |
StringBuffer |
format(long number,
StringBuffer toAppendTo,
FieldPosition pos) |
Number |
parse(String source,
ParsePosition parsePosition) |
clone, equals, format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
format, formatToCharacterIterator, parseObject
public ScientificNumberFormatter()
public ScientificNumberFormatter(int numDecimals, double lowerLimit, double upperLimit)
numDecimals
- the max number of decimals to displaylowerLimit
- gives a range around 0 [-lowerLimit, lowerLimit] for which each number inside the range
excluding 0 will be formatted with scientific notationupperLimit
- gives a range around 0 [-upperLimit, upperLimit] for which each number outside the range
will be formatted with scientific notationpublic StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
format
in class NumberFormat
public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
format
in class NumberFormat
public Number parse(String source, ParsePosition parsePosition)
parse
in class NumberFormat