Trim « decimal « Java Data Type Q&A





1. How to Trim Numbers if No Decimal Values    coderanch.com

I have number values that have two decimal places. I am using java to export these values to excel. I need to check the number, if it has no decimal value change it to integer, if it has display as is. I am also keeping a cumlative value for each column that needs to be handled the same way.

2. How to trim decimal????????    forums.oracle.com

3. Help with trimming decimals..    forums.oracle.com

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. ...