Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Find the maximum element in the array */
- private static int getMax(int[] elements) {
- int max = elements[0]; // 1
- for (int i = 1; i < elements.length; i++) { // 2
- if (elements[i] > max) { // 3
- max = elements[i]; // 3
- }
- }
- return max; // 4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement