How do you find the largest element in an array in Java?

Last Updated :
Discuss
Comments

How do you find the largest element in an array in Java?

Using Collections.max(arr)

Iterating and comparing each element

Using Math.max(arr)

Sorting and taking the first element

Share your thoughts in the comments