Help me ! identifying the mistake
Help me to identify the mistake ..
it's about selection sort .
I can't execute it properly although the builder shows (PROCESS COMPLETED)
Code:
import java.util.Scanner;
public class select
{
public static void main (String []args)
{
Scanner abc= new Scanner (System.in);
System.out.println("Enter 4 integers :");
int [] num = new int [4];
for (int i = 0 ; i<num.length ; i++)
{
num[i]= abc.nextInt();
}
for (int i = num.length-1 ; i >=0 ;i--)
{
int highest = i;
for (int j = i ; j>=0 ;i--)
{
if (num [j]> num [highest])
{
highest = j ;
}
}
int temp = num[i];
num[i] = num[highest];
num[highest]=temp;
}
for (int i = 0 ; i<num.length ; i++)
{
System.out.println(num[i]);
}
}
}
THANKS IN ADVANCE:)