As I know java doesn't supportsJava doesn’t support tail recursion optimization in general, but you can test it for your case,Java implementation for it; if it doesn't supportsdoesn’t support it, a simple for loopfor
-loop should be faster else they are same, otherwise recursion should be just as eachfast. On the other hand, but these are bit optimizationoptimizations, choose the onecode you think is easier and more readable.
I should also note that the fastest GCD algorithm is not euclideanEuclid’s algorithm, Lehmer'sLehmer’s algorithm is a bit faster.