import java.util.Arrays;
/**
*
*/public class AboutArray
{
	public static void main(String[] args)
	{
		int[] array = {17, 44, 1, 5, 7};

		//findMaxValue(array);
		//iteratorArray(array);
		for (String arg : args)
		{
			System.out.print("[" + arg + "]" + "\t");
		}
		//arraysSort(array);
		//arraysCopy(array);
		equals(array);
	}
	public static void iteraArray(int[] array)
	{
		//方式一
		for (int i = 0; i < array.length; i++)
		{
			System.out.print(array[i] + "\t");
		}
		System.out.println();
		//方式二
		for (int element : array)
		{
			System.out.print(element + "\t");
		}
	}
	public static void findMaxValue(int[] array)
	{
		int maxValue = array[0];
		for (int i = 0; i < array.length; i++)
		{
			if (array[i] > maxValue)
			{
				maxValue =array[i];
			}
		}
		System.out.println("最大值为：" + maxValue);
		//最小值
		int minValue = array[0];
		for (int element : array)
		{
			if (element < minValue)
			{
				minValue = element;
			}
		}
		System.out.println("最小值为；" + minValue);
	}
	public static void arrayCopy(int[] array)
	{
		System.out.println("原数组：" + array);
		for (int element : array)
		{
			System.out.print(element + "\t");
		}
		//赋值
		int[] copy = array;
		System.out.println("\n新数组：" + copy);
		for (int element : copy)
		{
			System.out.print(element +"\t");
		}
		//修改数组的值
		copy[1] = 77;
		System.out.println("\n修改新数组后：---------------------------");
		System.out.println("新数组：" + copy);
		for (int element : copy)
		{
			System.out.print(element + "\t");
		}
		System.out.println("\n原数组：" + array);
		for (int element : array)
		{
			System.out.print(element + "\t");
		}
		//将array重新指向新数组对象
		array = new int[] {25, 86};
		System.out.println("\n新数组地址：" + array);

		//拷贝
		int[] newArray = Arrays.copyOf(array, array.length) ;
		System.out.println("拷贝的新数组：" + newArray);
		for (int element : newArray)
		{
			System.out.print(element + "\t");
		}
	}
	public static void equals(int[] array)
	{
		int[] copy = Arrays.copyOf(array, array.length);
		System.out.println(Arrays.equals(array, copy));
	}
}