Others told you why, I am going to tell you how to round if you want to do this. If you are going to use only positive numbers, you can use this statement:
int a=(int) 1.5;
However (int) is always rounded to 0. Thus, if you want to make a negative number:
int a=(int) -1.5;
In my case, I did not want to do this. I used the following code for rounding, and it seems to handle all extreme cases well:
private static long floor(double a) { return (int) Math.floor(a); }
PearsonArtPhoto Oct 10 '13 at 23:17 2013-10-10 23:17
source share