lr12 -> e2-6

This commit is contained in:
2026-04-11 18:58:43 +05:00
parent 661d20744a
commit 7310b240fd
5 changed files with 105 additions and 0 deletions

21
lr12/e5.java Normal file
View File

@@ -0,0 +1,21 @@
package lr12;
import java.util.Arrays;
public class e5 {
public static int findMax(int[] arr) {
if (arr == null || arr.length == 0) {
throw new IllegalArgumentException("Empty");
}
return Arrays.stream(arr)
.parallel()
.max()
.getAsInt();
}
public static void main(String[] args) {
int[] arr = { 3, 8, 1, 99, 4, 12, 7, 45, -5, 88 };
System.out.println("Max: " + findMax(arr));
}
}