About 1,540,000 results
Open links in new tab
  1. Java Program to Find Largest Element in an Array

    Apr 9, 2025 · The most common method to find and print the largest element of a Java array is to iterate over each element of the array and compare each element with the largest value. …

  2. Finding the max/min value in an array of primitives using Java

    Sep 28, 2009 · Here we can use Arrays.stream() to get Max Value from a primitive array in Java. int [] numbers = {10,1,8,7,6,5,2}; int maxValue = Arrays.stream(numbers).max().getAsInt(); …

  3. Program to print the largest element in an array - Java

    Mar 17, 2025 · In this program, we need to find out the largest element present in the array and display it. This can be accomplished by looping through the array from start to end by …

  4. How to Find the Max Number in an Array in Java | Delft Stack

    Feb 2, 2024 · Find Maximum Number in an Array Using Arrays.sort() An array contains data of a similar type. While you can already read all the elements and perform several operations on …

  5. Java Program to Find Largest Element of an Array

    In this program, you'll learn to find the largest element in an array using a for loop in Java.

  6. Largest Element of the array using Java - PrepInsta

    Here, we will discuss the following methods to find the maximum element of the array. Method 1 : Using Iteration; Method 2 : Using recursion Top-down Approach; Method 3 : Bottom-up …

  7. Find Max and Min in an Array in Java - HowToDoInJava

    Feb 21, 2023 · Learn ways to find the maximum and the minimum element from an Array in Java using Stream API, Collections, simple iterations and recursion.

  8. How to Find the Maximum Element in an Array? - GeeksforGeeks

    Nov 15, 2024 · To find the maximum element in an Array in Java, we can sort the array in ascending order using the Arrays.sort() method and then we can access the last element of …

  9. Max element of an array in Java - Stack Overflow

    Mar 10, 2014 · In Java 8 You can use Stream: public static int maxArray(int[] a) { return Arrays.stream(a).max().getAsInt(); }

  10. How to Find the Largest Element in an Array in Java? - JavaBeat

    Dec 31, 2023 · In Java, various methods are available to find the maximum value in an array, such as Arrays.sort (), Collections.max (), recursive approach, etc. This write-up will present a …