This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes double to Int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "double to Int" Watch "double to Int" New topic

double to Int

Henas Cirtak

Joined: Oct 02, 2004
Posts: 10
How do you convert a type double to an type Int?
Amit Saini
Ranch Hand

Joined: Oct 20, 2004
Posts: 280
first of all you have to realize that while doing such a conversion, you might lose data, since double is wider than int.

you can use an explicit cast like this-

int i;
double d = 33.333;
i = (int)d;

hope this hepls.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: double to Int
jQuery in Action, 3rd edition