Answer to Question #155398 in Java | JSP | JSF for joy

Question #155398

write a java code that print the largest number of an array,


1
Expert's answer
2021-01-15T09:26:59-0500
public void findMax(int[] arr) {
    int max = Integer.MIN_VALUE;
    for (int i = 0; i < arr.length; i++) {
        max = Math.max(max, arr[i]);
    }
    System.out.println("The max number is: " + max);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog