pi is a double.
A. You can't shove a double into an int without casting.
B. Same as A. Rounding a double does not make it anything other than a double.
C. This does the cast from double to int - Good
D. The method min() takes 2 values separated by a comma and gives you back the lesser of the two. This example only has one input value (the result of the addition).
E. If you read the definition of what round does, it is exactly this arithmatic, as documented below.
The API says:
public static long round(double a)
Returns the closest long to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long. In other words, the result is equal to the value of the expression:
(long)Math.floor(a + 0.5d)
Special cases:
If the argument is NaN, the result is 0.
If the argument is negative infinity or any value less than or equal to the value of Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE.
If the argument is positive infinity or any value greater than or equal to the value of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE.
[This message has been edited by Cindy Glass (edited January 23, 2001).]