This commit is contained in:
Simoes Lukas
2025-05-26 12:07:58 +02:00
parent 2f94e24111
commit c16ef0985f
29 changed files with 1172 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
public class Largest {
/**
* Return the largest element in a list.
*
* @param list A list of integers
* @return The largest number in the given list
* @throws NullPointerException si le tableau est null
*/
public static int largest(int[] list) {
int max = list[0];
for (int index = 0; index <= list.length-1; index++) {
if (list[index] > max) {
max = list[index];
}
}
return max;
}
}