Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double to Int

Status
Not open for further replies.

mhall

Technical User
Sep 26, 2000
13
GB
I want to convert a Double to an Int to use the value in a progress bar, can anyone help.

Thanks
 

[tt]...
int i = new Double(d + .5).intValue();

d = your double variable

+ .5 is used to round the int. with out it the decimal portion of the double is just truncated
...[/tt] I hope this helped! ;-)
- Casey Winans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top