write euclid's gcd algorithm in java