How can I convert a double to an int?

Joined
Aug 20, 2008
Messages
1
Reaction score
0
How can I convert a double to an int? I'm trying to use the
Code:
Double.intValue()
method, but I don't know how. I've tried all the ways I can think of, but they don't work:

Code:
int x = Double.intValue();
gives the error "non-static method intValue() cannot be referenced from a static context."

Code:
int x = arrayDoubleVal.Double.intValue();
gives the error "double value cannot be dereferenced."

Finally,
Code:
int x = Double.intValue(arrayDoubleVal);
gives the error "cannot find symbol - method intValue(double)".

I know, in all likelihood, I've missed something very obvious and I'll kick myself when someone points it out. But I'll just be happy if I can get it to work.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top