First refinement of the algorithm:
public static int greatestCommonDivisor(int x, int y){
int gcd;
initialize gcd to the minimum of x and y
while ((gcd > 1) && (we have not found a common divisor))
if (gcd divides both x and y)
we have found a common divisor
else
gcd-;
return gcd;}
Observations: