Quistion regarding selection sort`

package sortings;

public class SelectionSort {
public static void selects(int[] input)
{
for(int i=0;i<input.length-1;i++)
{
int min=input[i];
int minIndex=i;
for(int j=i+1;j<input.length;i++)
{
if(input[j]<min)
{
min=input[j];
minIndex=j;
}
}
if(minIndex!=i)//here i dont understand why we comparing minindex!=i if both are same
{
input[minIndex]=input[i];
input[i]=min;
}

	}
}
public static void main(String[] args)
{
	int input[]= {2,6,9,1,5};
	selects(input);
	for(int i=0;i<input.length;i++)
	{
		System.out.println(input[i]+ " ");
	}
}

}
if(minIndex!=i)//here i dont understand why we comparing minindex!=i if both are same
{

@missroy Notice the code given below-

int minIndex = i;
			for (int j = i + 1; j < input.length; i++) {
				if (input[j] < min) {
					min = input[j];
					minIndex = j;
				}
			}
            if (minIndex != i)// here i dont understand why we comparing minindex!=i if both are same
			{
				input[minIndex] = input[i];
				input[i] = min;
			}

minIndex and i are not same. We have just initialized minIndex as i and if the condition in the for loop stratifies then minIndex will get updated so they will not be same.