Arrange numbers in ascending order without using array sort method

import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a number");
int arr[]=new int[10];
int rep[]=new int[10];
int t=0;
for(int i=0;i<5;i++)
{
arr[i]=sc.nextInt();
}
int c=0;
for(int j=0;j<1000;j++)
{
for(int k=0;k<5;k++)
{
if(j==arr[k])
{
rep[t]=j;
t++;
}

}
}
System.out.println("sorted array");
for(int i=0;i<5;i++)
System.out.println(rep[i]+" ");
}
}

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...