int Asum,temp4;
temp4=Math.sqrt(Asum);
This is part of a code I'm writing. I've declared Asum and temp4 as integers. I'm trying to get the sqrt of Asum and assign it to temp4. but for some reason, java gives me the error : Possible loss of precision. reqd=int. found= double. I need temp4 and Asum to be an integer. and it's not necessary to get the precise decimal values, I just need the rounded off integers.
Have you tried to add an explicit cast to int so that the compiler knows that you know what you are doing?
temp4= (int) Math.sqrt(Asum);