Popular way to approximate sqrt(x) and 1/sqrt(x):
public static float isqrt(float x)
{
float hx = x * 0.5f;
int ix;
float r;
// make initial guess
ix = Float.floatToRawIntBits(x);
ix = 0x5f3759df - (ix>>1);
r = Float.intBitsToFloat(ix);
// do some number of newton-ralphson steps,
// each doubles the number of accurate
// binary digits.
r = r*(1.5f-hx*r*r);
//r = r*(1.5f-hx*r*r);
//r = r*(1.5f-hx*r*r);
//r = r*(1.5f-hx*r*r);
return r; // 1/sqrt(x)
//return r*x; // sqrt(x)
}