*public class Utilities {}*

**This class contains all the utility functions used by individual
programs.**

**Constructor Index:**

Utilities()

**Method Index:**

*static int gcd( int a, int b )*- This computes the greatest common divisor of
*a*and*b.* *static boolean isprime( int p )*- This checks whether
*p*is a prime number. *static void swap( int[] arr, int i, int j )*- This swaps the `i'th and `j'th values of
*arr[].*This is used by the*sort()* - method defined below.
*static void sort( int[] arr, int low, int high )*- This sorts the array
*arr*between*low*and*high.* *static int order_in_Ugroup( int elt, int n )*- This returns the order of the element
*elt*in*U(n).*Returns -1 if there is an - error.
*static int order_in_Ugroup( int elt, int n, vector vals )*- This returns the order of the element
*elt*in*U(n)*and stores the group - generated by
*elt*in the*vector vals.*Returns -1 if there is an error. *static int order_in_Zgroup( int elt, int n )*- This returns the order of
*elt*in*Z*. Returns -1 if there is an error._{n} *static boolean is_in_Ugroup( int elt, int n )*- This checks whether
*elt*is in*U(n)*. *static boolean is_identity_in_ZxZ( int M, int N, Ordered_pair op )*- This checks whether the element
*op*is the identity element in*Z*._{M}+ Z_{N} *static int Order_in_ZxZ( int M, int N, Ordered_pair op )*- This returns the order of
*op*in*Z*. Returns -1 if there is an error._{M}+ Z_{N} *static boolean is_in_ZxZ( int M, int N, Ordered_pair op )*- This checks whether
*op*is in*Z*._{M}+ Z_{N} *static void prime_factorization( vector vect, int number )**This gives the prime-factorization of the integer 'number' and stores it in**the vector 'vect' as algebra.Ordered_pair*s*. Where the first component of**the Ordered_pair is the prime number and the second component is the power**of that prime_number.**static void partitions( int n, vector vect )**This computes the partitions of the integer 'n' and stores them in a vector as an**array of integers.**static void GxG( int n, vector G1, vector G2, vector G1XG2)**This computes the internal direct product of G1 and G2 and stores it in G1XG2.**Also, it is assumed that both G1 and G2 are subgroups of U(n).*