|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.hws.jcm.data.NumUtils
public class NumUtils
This class provides a few static functions for converting real numbers to strings and strings to real numbers. It should probalby be reimplemented to use the standard NumberFormat class for converting real to string.
| Constructor Summary | |
|---|---|
NumUtils()
|
|
| Method Summary | |
|---|---|
static String |
realToString(double x)
Return a string representation of the real number x occupying, if possible, at most 10 spaces. |
static String |
realToString(double x,
int width)
Goal is to return a reasonable string representation of x, using at most width spaces. |
static double |
stringToReal(String s)
Return the real number represented by the String s, or return Double.NaN if s does not represent a legal real number. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NumUtils()
| Method Detail |
|---|
public static double stringToReal(String s)
public static String realToString(double x)
public static String realToString(double x,
int width)
x - value to create string representation of.width - maximum number of spaces used in string representation, if possible.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||