title: Java: Get Greatest Common Divisor, which method is better?
body: <p>From this question <a href="https://stackoverflow.com/questions/4009198/java-get-greatest-common-divisor">Java: get greatest common divisor</a></p>
  
  <p>In getting the gcd of any data type whether <code>int</code>, <code>long</code>, <code>Integer</code>, <code>Long</code>, which answer is better in terms of precision, speed, cpu usage, etc.?</p>
  
  <p>A: </p>
  
  <pre><code>private static int gcdThing(int a, int b) {
      return BigInteger.valueOf(a).gcd(BigInteger.valueOf((b))).intValue();
  }
  </code></pre>
  
  <p>B:</p>
  
  <pre><code>public int GCD(int a, int b) { return b==0 ? a : GCD(b, a%b); }
  </code></pre>