// very fast square root approximation
    public final static int sqrt( long val ) {
        long temp, g = 0, b = 0x8000, bshft = 15;
        do {
            if( val >= ( temp = ( ( ( g << 1 ) + b ) << bshft-- ) ) ) {
                g += b;
                val -= temp;
            }
        } while( ( b >>= 1 ) > 0 );
        return (int)g;
    }
Hang on... that casts the answer into an int. That's a little TOO approximate for my liking. -- Tango
It's also about 10 times slower than Math.sqrt() on my machine... Maybe this whole idea was bad. :-p --David Alves
I think a lot of these functions are implemented in hardware, so making interpreted software variants may not help. -- Kawigi