This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "double to Int" Watch "double to Int" New topic
Author

double to Int

Henas Cirtak
Greenhorn

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: double to Int