
class Utility2 {

	static void printArray(int[] arr) {
		for(int elm: arr) {
			System.out.print(elm + " ");
		}
		System.out.println();
	}

	/* Write a method named copy that copies
		the contents of the first argument into
		the second arguement.  Both arguments
		are arrays of integers.
	*/

	static void copy(int[] src, int[] dest) {
		int len = (src.length < dest.length) ? src.length : dest.length;
		for(int i = 0; i < len; i++) {
			dest[i] = src[i];
		}
	}

	/* Write a method named copy that takes two 
		2D arrays as arguments and returns false
		if the arrays are of different dimensions.
		Otherwise, the method copies the contents
		of the first into the second and returns true.
	*/

	static boolean copy(int[][] src, int[][] dest) {

		if (src.length != dest.length) {
			return false;
		}

		for(int i = 0; i < src.length; i++) {
			if(src[i].length != dest[i].length) {
				return false;
			}
		}

		for(int i = 0; i < src.length; i++) {
			for(int j = 0; j < src[i].length; j++) {
				dest[i][j] = src[i][j];
			}
		}
		return true;
	}

	static void printMatrix(int[][] src) {
		for(int i = 0; i < src.length; i++) {
			for(int j = 0; j < src[i].length; j++) {
				System.out.print(src[i][j] + " ");
			}
			System.out.println();
		}
	}
}
