Take a look at the Integer and Double classes. I don't have my references with me right now (I usually leave them at work). But the Double class has all kinds of formatting capaiblities.
Such as if you have a double value called dblVal then you could use code such as this...
double dblVal;
int intVal;
*** code to set value of dblVal ***
Double dblClassInstance = new Double (dblVal);
intVal = dblClassInstance.intValue ();
however this WILL cause loss of precision. such that if dblVal = 3.12159 then the resulting intVal may be just 3.
perhaps a better option would be to print a rounded value of 3.12?
or perform some type of formatting in the print statement... while I'm not certain I think I remember reading somewhere that Java println functions can handle to some extent formatting like what is available in C's printf statements.
Check out the class definition / descriptions here:
http://java.sun.com/j2se/1.3/docs/ap...ng/Double.html
here's a link about formatting strings in Java:
http://developer.java.sun.com/develo...mming/sprintf/
hth,
jpbarto