I am wondering how to do this.

Implement a method static int gcd(int a, int b) to compute and return the greatest common divisor of a and b using the euclidean algorithm.

In the main method, prompt the user to enter an integer n using a dialog box. Perform n trials of gcd calculations on random integers. In each trial, randomly generate a pair of positive integers a and b between 1 and 1000000. Count the total number of pairs with gcd(a,b)=1. Display the total count in a dialog box.

Please help me.