What is wrong of my solution for the Leetcode puzzle Sqrt(x)?
<p>I am working on the LeetCode question No.69 named sqrt(x)(<a href="https://leetcode.com/problems/sqrtx/" rel="nofollow">https://leetcode.com/problems/sqrtx/</a>). It asked me to return the square root of the integer also in another integer. Below is my solution.</p>

<pre><code>public class Solution {
    public int mySqrt(int x) {
    int i = 0;
    if(x==0)
    {
        return 0;
    }
    for(i = 1;i&lt;x/2;i++)
    {
        if(((i*i)&lt;=x)&amp;&amp;((i+1)*(i+1)&gt;x))
        {
            break;
        }
    }

    return i;
   }
}
</code></pre>

<p>After I submit the code, all the test cases where x >= 2147395600 are all failed. When x = 2147395600, it is returning a 289398 instead of  46340, which is the right answer. What is the problem with my code? </p>