Using Math.floor
When I use Math.floor I get an integer part of a double rigth?
For exemple >> If I have
double num = 34.54
Math.floor(num) will return 34 rigth?
But this 34 is a double 34.0 or is an integer 34?
If not an integer, how can I do to get the integer part "34" like a integer number 34 and not like a double 34.0?
[353 byte] By [
coelholdsa] at [2007-11-26 22:42:38]

Yes I already did it but it is not working
Here is the code
private void confirm(Double list[]){
int nParcelas = (int)(list[2]);
.....
I call the function confirm from another class, and I pass a list like parameter.
I have the same fuction but is a list of String and work ok. I get the numbers of this list and make some operations and averything works find...
But I want to get an item of this list and get its integer part, and it it's not working....
> > You need to convert your Double to a double before
> > casting it to an int.
>
> not exactly. Double has an intValue() method.
Oops, I thought it did, I even checked the API before posting. Must have missed it though. I even thought to myself "Kinda stupid Double doesn't have an 'intValue()' method...". : )
> rsrsrs .....:( rsrs
>
> thank you very much
>
> now it is working
>
> So let me see if I understood....
>
> Double is a class witch have a lot of methods, etc
Yes. It is called a wrapper class. Just like java.lang.Integer (wrapper for an int), java.lang.Boolean (wrapper for a boolean), ...
> double is the type of a nunber but it is not a class
>
> Am I right?
Correct. Those are called primitives:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html