Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help with trimming decimals..

807589Nov 29 2008 — edited Nov 30 2008
Alright i'm gonna get straight to the point. I have the following variable to calculate percent:
double percent = numWritten / FileSize * 100.0;
the problem is that it gives me a long decimal such as 2.535698734087. how can i trim this to a decimal such as 2.5? Please do not link me to some other page, or anything like that. give me a direct awnser, or the code to do it, and i will give you all 10 duke stars. DO NOT give me a link to some help page. thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2008
Added on Nov 29 2008
14 comments
202 views