public class ScientificFormat extends Format
Format.Field
Constructor and Description |
---|
ScientificFormat() |
ScientificFormat(int sigDigit,
int maxWidth,
boolean SciNote)
Sets the significant digits, maximum allowable width and number formatting style
(SciNote == true for Pure formatting).
|
Modifier and Type | Method and Description |
---|---|
String |
format(double d)
Format the number using scientific notation
|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
Implementation of inherited abstract method.
|
int |
getMaxWidth()
The maximum allowable width of formatted number excluding any exponentials
|
boolean |
getScientificNotationStyle()
The formatting style: True means Pure scientific formatting, False means standard.
|
int |
getSigDigits()
Number of significant digits.
|
Object |
parseObject(String source,
ParsePosition pos)
Dummy implementation of inherited abstract method.
|
void |
setMaxWidth(int mWidth)
Sets the maximum allowable length of the formattted number mantissa before exponential notation
is used.
|
void |
setScientificNotationStyle(boolean sciNote)
Sets the format style used.
|
void |
setSigDigits(int SigDigit)
Sets the number of significant digits for the formatted number
|
clone, format, formatToCharacterIterator, parseObject
public ScientificFormat()
public ScientificFormat(int sigDigit, int maxWidth, boolean SciNote)
sigDigit
- number of significant digitsmaxWidth
- maximum allowed widthSciNote
- whether to use scientific notationpublic StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
public Object parseObject(String source, ParsePosition pos)
parseObject
in class Format
public int getSigDigits()
public int getMaxWidth()
public boolean getScientificNotationStyle()
public void setSigDigits(int SigDigit)
SigDigit
- number of significant digits.public void setMaxWidth(int mWidth)
mWidth
- maximum allowable length before exponentpublic void setScientificNotationStyle(boolean sciNote)
sciNote
- whether to use scientific notation.public String format(double d)
d
- the numberCopyright © 2020. All rights reserved.