get biggest value in array code example
Example 1: get largest number in array javascript
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 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);