Answers for "java highest number in array"

3

max in array java

// Initializing array of integers 
        Integer[] num = { 2, 4, 7, 5, 9 }; 
// using Collections.min() to find minimum element 
        // using only 1 line. 
        int min = Collections.min(Arrays.asList(num)); 
  
        // using Collections.max() to find maximum element 
        // using only 1 line. 
        int max = Collections.max(Arrays.asList(num));
Posted by: Guest on September-24-2020
0

max array number in java

Integer[] num = { 2, 4, 7, 5, 9 };
        // using Collections.min() to find minimum element
        // using only 1 line.
        int min1 = Collections.min(Arrays.asList(num));

        // using Collections.max() to find maximum element
        // using only 1 line.
        int max1 = Collections.max(Arrays.asList(num));
        System.out.println(min1); // 2 
        System.out.println(max1); // 9
Posted by: Guest on June-04-2021
0

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);
Posted by: Guest on February-15-2020

Code answers related to "java highest number in array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language