я что то не понимаю. программа выводит минимальное число и его индекс так в чем прикол?
не проходит по полследнему пункту
package com.javarush.task.task12.task1233;
/*
Изоморфы наступают
*/
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 = getMinimumAndIndex(data);
System.out.println("The minimum is " + result.x);
System.out.println("The index of the minimum element is " + result.y);
}
public static Pair<Integer, Integer> getMinimumAndIndex(int[] array) {
int x = 0,y=0;
int n = array.length;
if (array == null || array.length == 0) {
return new Pair<Integer, Integer>(null, null);
}
else
for (int i = 0;i < n;i++){
if (x > array[i]){
x = array[i];
y=i;
}
}
return new Pair<Integer, Integer>(x,y);
}
public static class Pair<X, Y> {
public X x;
public Y y;
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
}
}