Skip to main content

[JAVA2D] FW: Double to int

2 replies [Last post]
Anonymous

How do I convert a double to an int, so I can add it to a vector?

Thanks.

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Michele Puccini

A simple solution: use a cast I=(int)D;
Be warned: you'll loose precision, a lot of, so you must be aware of what
you're doing.
But.. what do you mean with "add to a vector". Vectors can be made of
everything.

Mik of ClassX
--

----- Original Message -----
From: "theresa gartland-jones"
To:
Sent: Friday, April 23, 2004 12:06 PM
Subject: [JAVA2D] FW: Double to int

> How do I convert a double to an int, so I can add it to a vector?
>
> Thanks.
>
>
===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Auguste Genovesio

I would say every "object things" since primitive type cannot be handle by
Vector.

If your problem was "how could i put an int in a Vector ?"
the solution is : vector.addElement(new Integer(myint))

----- Original Message -----
From: "Michele Puccini"
To:
Sent: Friday, April 23, 2004 12:16 PM
Subject: Re: [JAVA2D] FW: Double to int

> A simple solution: use a cast I=(int)D;
> Be warned: you'll loose precision, a lot of, so you must be aware of what
> you're doing.
> But.. what do you mean with "add to a vector". Vectors can be made of
> everything.
>
> Mik of ClassX
> --
>
>
>
> ----- Original Message -----
> From: "theresa gartland-jones"
> To:
> Sent: Friday, April 23, 2004 12:06 PM
> Subject: [JAVA2D] FW: Double to int
>
>
> > How do I convert a double to an int, so I can add it to a vector?
> >
> > Thanks.
> >
> >
>
===========================================================================
> > To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> > of the message "signoff JAVA2D-INTEREST". For general help, send email
to
> > listserv@java.sun.com and include in the body of the message "help".
> >
>
>
===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".