email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

To round to decimals, there is 2 ways of doing it:

 

Say you have double x which is a long double.

 

a.

int rounded=(int)(x*100);  //I forced x*100 to be an int which loses decimal
double newX=rounded/100.00;
            
            

Better way:

b.

System.out.println( java.text.NumberFormat.getCurrencyInstance().format(x));