I'm pretty sure I'm overthinking this problem and there is an easier way to do this, but why isn't my code verifying? I get the correct output.

package com.codegym.task.task12.task1233;
import java.util.ArrayList;
import java.util.Arrays;
/*
The isomorphs are coming
*/
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) {
if (array == null || array.length == 0) {
return new Pair<Integer, Integer>(null, null);
}
int[] dataCopy = new int[array.length];
dataCopy = Arrays.copyOf(array,array.length);
int temp = 0;
int i;
int j = 1;
for (i = 0; i < array.length; i++) {
for (j = 1; j < array.length - i; j++) {
if (array[j - 1] > array[j]) {
temp = array[j-1];
array[j-1] = array[j];
array[j] = temp;
}
}
}
Integer a = array[j];
Integer k = 0;
for (int b = 0; b < array.length; b++) {
if (a == dataCopy[b]) {
k = b;
}
}
return new Pair<Integer, Integer>(a, k);
}
public static class Pair<X, Y> {
public X x;
public Y y;
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
}
}