Since MIDP does not support floating point numbers, they most likely left out most real calculations. If you still want to do it, here are a couple of sites which discuss various algorithms, but be prepared for soem work.
http://jwilson.coe.uga.edu/EMT668/EMAT4680.folders/Nowlen/squareroot.html
http://www.math.toronto.edu/mathnet/questionCorner/sqrootcalc.html
http://www-vis.imag.fr/AcornDemos/Techies/SquaRoot.html
Try the next piece of code; it calculates the integer closest to the square root of the argument (or zero if the argument is less than 0):
public static int sqrt(int i) {
if (i < 0) return 0;
if (i < 3) return 1;
i--;
int j = i;
int k = 0;
while (j != k) {
k = j;
j = (k + i / k + 1) / 2;
}
return j;
}
Good luck,
-Ernst