Posted By:
elango_maragtham
Posted On:
Thursday, June 7, 2001 06:42 PM
Hi ramesh babu .
i have attached a code to round the decimal to appropriate decimal places ..
It will return a String.
public String test(double number,int decimal){
String pattern = "####";
for(int i=0;iif(i==0)
pattern+=".0";
else
pattern+="0";
}
DecimalFormat df1 = new DecimalFormat(pattern);
System.out.println(number+"--->"+df1.format(number));
return(df1.format(number));
}
To convert this String into double u use (Double.valueOf(String)).doubleValue()method to get double value ...
For any help mail to me elangomca@yahoo.com
and