import java.util.Scanner;

class Oct8 {
	public static void main(String[] args) {

		Scanner kb = new Scanner(System.in);

		int[] ref = new int[10];

		int i = 0;
		int first = ref[i];

		System.out.println("first: " + first);
		System.out.println("first: " + ref[i]);
	
		int len = ref.length;

		for(i = 0; i < len; i++) {
			System.out.printf("%d: %d\n", i, ref[i]);
		}

		ref[3] = 7;
	
		printArray(ref);

		int[] array1 = {3,5,7,9};

		printArray(array1);

		for(i = 0; i < array1.length; i++) {
			System.out.println("enter an integer");
			int value = kb.nextInt(); 
			array1[i] = value;
		}

		printArray(array1);

		setArray(array1, 76587);
		printArray(array1);
	
		int[] array2 = createArray(7, 15);
		printArray(array2);

		int[] array3 = createArray(7, 15);
	
		System.out.println("equals: " + equalArrays(array2,array3));

		array3[5] = 0;
		System.out.println("equals: " + equalArrays(array2,array3));
	
	}

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

	/*
	 * create a method named setArray that takes an
	 * array of integers and an integer as arguments
	 * and sets all of the elements in the first array
 	 * to the value of the second parameter
	 */

	static void setArray(int[] arr, int key) {
		for(int i = 0; i < arr.length; i++) {
			arr[i] = key;
		}
	}

	/*
	 * write a method named createArray that takes an integer
	 * as an argument and returns an array if integers having
	 * the length of the value in the parameter
	 */

	static int[] createArray(int n, int key) {
		int[] arr = new int[n];
		setArray(arr, key);
		return arr;
	}

	/*
	 * create a method named equalArrays that takes
	 * two integer arrays as an argument and returns
	 * true if they are equal otherwise returns false.
	 */

	static boolean equalArrays(int[] a, int[] b) {
		if (a.length != b.length) {
			return false;
		}

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

}

// end of file










