source file name: array1.java

class array1

{

public static void main(String as[])

{

int arr[]={10,5,25,3,-4,100};

System.out.println("Array numbers before sorting");

for(int i=0;i<arr.length;i++)

System.out.println(arr[i]);

int i,j;

for(i=0;i<arr.length;i++)

{

for(j=0;j<arr.length;j++)

{

if(arr[i]<arr[j])

{

int t=arr[i];

arr[i]=arr[j];

arr[j]=t;

}

}

}

System.out.println("Array numbers after sorting");

for(i=0;i<arr.length;i++)

System.out.println(arr[i]);

}

}

output:
D:\JavaPrograms\ArrayPrograms>javac array1.java

D:\JavaPrograms\ArrayPrograms>java array1
Array numbers before sorting
10
5
25
3
-4
100
Array numbers after sorting
-4
3
5
10
25
100