a question about precision loss
hi
ive written this simple method dealing with rectangles, but im getting a loss of precision error... i understand that the get methods return doubles but ive tried casting it as an integer, ie (Integer) at the start of the value statement but it doesnt sort it... im a little stumped, can anyone offer any advice?
heres the code:
public int randYAlgae(int index)
{
int pick = rand.nextInt(2);
if(pick == 0)
return (((Rectangle)algaeset.get(index)).getY()) + 5;
else if (pick == 1)
return (((Rectangle)algaeset.get(index)).getY()) - 5;
else return (((Rectangle)algaeset.get(index)).getY());
}

