recursion dilemma
<p>I'm trying to create code to find the GCD of three user inputed numbers. My goal is to call the method with the inputed numbers, divide by q which is initialized as 1, record q only if the remainder is zero, then determine if its greater or equal to the smallest number, if it is not, increase q and recall method but if it is i would like to print out the largest last recorded q, what am i doing wrong? i keep getting stack overflow errors. </p>

<pre><code>public static int recursiveMethod (int x, int y, int z, int q)
{
    int largestVar; 
    int xRes = x % q;
    int yRes = y % q;
    int zRes = z % q;
    if (xRes==0 &amp;&amp; yRes ==0 &amp;&amp; zRes==0) {
                largestVar = q;
                if (q &gt;= x &amp;&amp; q &gt;= y &amp;&amp; q &gt;= z)
                {
                    return largestVar;
                }
    }
    else { 
           q++;
    }
   return recursiveMethod(x, y, z, q);
</code></pre>
