what is the Problem ?
package de.codegym.task.task11.task1123;
public class Solution {
public static void main(String[] args) throws Exception {
int[] data = new int[]{1, 2, 3, 5, -2, -8, 0, 77, 5, 5};
Pair<Integer, Integer> result = getMinimumAndMaximum(data);
System.out.println("Die kleinste Zahl ist " + result.x);
System.out.println("Die größte Zahl ist " + result.y);
}
public static Pair<Integer, Integer> getMinimumAndMaximum(int[] array) {
int max = -1;
int min = -1;
if (array == null || array.length == 0) {
return new Pair<Integer, Integer>(null, null);
}else{
for (int i = 0; i < array.length; i++){
if(array[i] >= max){
max = array[i];
}
if (array[i] <= min){
min = array[i];
}
}
return new Pair<Integer , Integer> (min, max);
}
}
//schreib hier deinen Code
public static class Pair<X, Y> {
public X x;
public Y y;
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
}
}