intValue
public int intValue()
Returns the value of this Double as an int (by casting to type int). Specified by:
intValue in class Number
Returns:
the double value represented by this object converted to type int
public int intValue()
Returns the value of this Double as an int (by casting to type int). Specified by:
intValue in class Number
Returns:
the double value represented by this object converted to type int
int i = (new Double(d)).intValue();
int i = (int)d;
int i = (int)d;
正如上面所说:
double d = 12.0;
int i = (int)d;
不过,会丢失一部分信息。
int tmp = (int)test;
double tail = test-tmp;呵呵!