Answers for "how to sort int array in java"

1

how to sort integer array in java

int countOfArray = 5;
int num [] =  new int[counfOfArray];

int num[] = [8 , 5 , 9 , 3 , 4];

for (int i = 0; i < countOfArray; i++) 
        {
            for (int j = i + 1; j < countOfArray; j++) { 
                if (num[i] > num[j]) 
                {
                    temp = num[i];
                    num[i] = num[j];
                    num[j] = temp;
                }
            }
        }
Posted by: Guest on January-08-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language