class Sort1
{
public static void main(String[] args)
{
int []arr={3,5,7,9,13,19} ;
sort(arr);
}
public static void sort(int [] arr)
{
System.out.print("[");
for (int x=0;x<arr.length ;x++ )
{
for (int y=arr.length-1;y>x ;y-- )
{
int f =arr[x];
if (arr[x]<arr[y])
{
arr[x]=arr[y];
arr[y]=f;
}
}
System.out.print(arr[x]);
if (x<arr.length-1)
{
System.out.print(",");
}
}
System.out.print("]");
}
}
|
|