I am working on a program in which 10000 random no repeat numbers are selectively sorted into ascending order.

I have written the following code:

    import java.util.Random;
    
    
    public class Sorting {
        public static void main (String[] args){
            //Here, we initiate an array with the integers
            //1 through 10,000 in order.
            Random rgen = new Random();
            int[] intArray = new int[10000];
            for (int i=0; i<10000; i++) {
                intArray[i] = i+1;
            }
            //Here, we randomize the positions.
            for (int i=0; i<10000; i++) {
                int randomPosition = rgen.nextInt(10000);
                int temp = intArray[i];
                intArray[i] = intArray[randomPosition];
                intArray[randomPosition] = temp;
            }
            //Here, we check for the maximum in the 
            //unsorted section of the list.
            int max;
            for (int i=9999; i>=0; i--) {
                max = i;
                for (int j=i-1; j>=0; j--)
                    if (intArray[j]>intArray[max]) {
                        max = j;
                    }
                //Here, we swap the positions of the 
                //maximum and the last value in the 
                //unsorted section of the list.
                if (max != i) {
                    int tmp = intArray[i];
                    intArray[i] = intArray[max];
                    intArray[max] = tmp;
                }
            }
            //Here, we output the result.
            for (int k=0; k<10000; k++) {
                System.out.println(intArray[k]);
            }
        }
    }

I know I asked a similar question earlier, but I would appreciate any help.