Selection sort challange

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn=new Scanner(System.in);

		  int[] array=new int[5];
		  for(int i=0;i<array.length;i++){
			  array[i]=scn.nextInt();
		  }
		  selectionsort(array);
		  display(array); 
}
public static void selectionsort(int[] array){
	for(int i=0;i<array.length;i++){
		int min=i;
		for(int j=i+1;j<array.length;j++){
			if(array[j]<array[min]){
				min=j;
			}
		}
		int temp=array[min];
		array[min]=array[i];
		array[i]=temp;
	}
}
public static void display(int[] array){
	for(int i=0;i<array.length;i++){
		System.out.print(array[i]+" ");		}
}

}

Hey @Sumant391
logic is fine :
take input N
correct code :

import java.util.*;

public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int[] array = new int[n];
for (int i = 0; i < array.length; i++) {
array[i] = scn.nextInt();
}
selectionsort(array);
display(array);
}

public static void selectionsort(int[] array) {
	for (int i = 0; i < array.length; i++) {
		int min = i;
		for (int j = i + 1; j < array.length; j++) {
			if (array[j] < array[min]) {
				min = j;
			}
		}
		int temp = array[min];
		array[min] = array[i];
		array[i] = temp;
	}
}

public static void display(int[] array) {
	for (int i = 0; i < array.length; i++) {
		System.out.println(array[i]);
	}
}

}