title: Java - Recursive function of the Euclidean Algorithm
body: <p>I can't seem to convert the following algorithm into Java successfully, please forgive the horrible picture quality but a question I'm working on asks:</p>
  
  <p><img src="https://i.stack.imgur.com/KALct.jpg" alt="Euclidean Algorithm"></p>
  
  <p>I have tried to use the following code to represent the Euclidean Algorithm, but it doesn't seem to work. I don't really know how I would go about representing it in Java code. Any help?</p>
  
  <pre><code>public static int gcd(int x, int y) {
      if (y == 0) {
          return x;
      } else if (x &gt;= y &amp;&amp; y &gt; 0) {
          return gcd(y, (x % y));
      }
  }
  </code></pre>
  
  <p>Thank you.</p>