determine min and max for array code example

Example 1: javascript min max array

Math.max(1, 2, 3)    // 3
Math.min(1, 2, 3)    // 1

var nums = [1, 2, 3]
Math.min(...nums)    // 1
Math.max(...nums)    // 3

Example 2: how to find max in array

int[] a = new int[] { 20, 30, 50, 4, 71, 100};
		int max = a[0];
		for(int i = 1; i < a.length;i++)
		{
			if(a[i] > max)
			{
				max = a[i];
			}
		}
		
		System.out.println("The Given Array Element is:");
		for(int i = 0; i < a.length;i++)
		{
			System.out.println(a[i]);
		}
		
		System.out.println("From The Array Element Largest Number is:" + max);