Skip to content

Commit 709d91d

Browse files
authored
fix: correct file path and structure
1 parent e4fe11d commit 709d91d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.thealgorithms.arrays;
2+
public class MaximumElement {
3+
public static int findMax(int[] arr) {
4+
int max = Integer.MIN_VALUE;
5+
6+
for (int num : arr) {
7+
if (num > max) {
8+
max = num;
9+
}
10+
}
11+
12+
return max;
13+
}
14+
15+
public static void main(String[] args) {
16+
int[] arr = {1, 5, 3, 9, 2};
17+
System.out.println("Maximum element: " + findMax(arr));
18+
}
19+
}

0 commit comments

Comments
 (0)