What is wrong in this code?
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int N = scn.nextInt();
if (N >= 0) {
int[] arr = new int[N];
int i, j;
for (i = 0; i < N; i++) {
int tmp = scn.nextInt();
if(tmp>=-1000000000&&tmp<=1000000000) {
arr[i]=tmp;
}
}
int counter = 0;
int min = counter;
while (counter < N - 1) {
min = counter;
for (j = counter + 1; j < N; j++) {
if (arr[j] < arr[min]) {
min = j;
}
}
int tmp = arr[min];
arr[min] = arr[counter];
arr[counter] = tmp;
counter++;
}
for (i = 0; i < N; i++) {
System.out.print(arr[i]+" ");
}
}
}
}