find largest number in the given array in java code example
Example 1: java find biggest number in array
for (int counter = 1; counter < decMax.length; counter++)
{
if (decMax[counter] > max)
{
max = decMax[counter];
}
}
System.out.println("The highest maximum for the December is: " + max);
Example 2: how to find the largest number in java
int number1 = 2;
int number2 = 1;
System.out.println("The largest number is " + Math.max(number1, number2));
System.out.println("The smallest number is " + Math.min(number1, number2));