public int gcd(int num1, int num2){
        if(num1 > num2){
            int temp = num1;
            num1 = num2;
            num2 = temp;
        }
        while(num1 != 0){
            int temp = num1;
            num1 = num2 % num1;
            num2 = temp;
        }
        return num2;
    }
GCD greatest common divisor
Co prime numbers if GCD of both the numbers is 1
src/com/interview/number/EuclideanAlgoForGCD.java