U | New g/cis3115/hw1.pdf Q3: Write each of the following functions as static methods in Java. 1. static int ged (int x, int y): Return the greatest common divisor of x and y 2. static int sumEven(int a): Return the sum of the even integers 3. static boolean sorted (int[] a) Test if array a is sorted in 4. static int copy (int[] a): Return a copy of array a. in array a ascending order. s static int(l eliminateDuplicates (int[) a): Retum a copy of array a without duplicates, For example, for a n2,1,2,2,31,the returned array is (1,2 6. static char tic_tac teo (char[ grid): Given a 3x3 gricd configuration represented as a two-dimensional array, where each entry is or O', returnX' if the configuration is a win for x', O' if the configuration is a win for 'o, and 'D' if the configuration is a draw. 7. static long bin str_to int (String binstr): Convert an unsigned binary string to a decimal integer. For example, for binstr- 11010", the returned integer is 26. New ing/cis3115/hw1.pdf Q3: Write each of the following functions as static methods in Java. 1. static int gcd (int x, int y): Return the greatest common divisor of x and y 2. static int sumEven (inttl a): Return the sum of the even integers 3. static boolean sorted (int[] a):Test if array a is sorted in 4. static intll copy (intl a): Return a copy of array a. in array a. ascending order. 5. static intl] eliminateDuplicates (intl] a): Return a copy of array a without duplicates. For example, for a- [1,2,1,2,2,3], the returned array is [1,2,3]. 6. static char tic tac teo (char[11) grid) : Given a 3x3 grid configuration reprsented as a two-dimensional array, where each entry is 'X or 'O', return x if the configuration is a win for X', 0 if the configuration is a win for 'O', and 'D' if the configuration is a draw. static long bin str_to int (String binstr) Convert an unsigned binary string to a decimal integer. For example, for binstr 11010 the returned integer is 26