import static java.lang.System.out;
import java.util.Arrays;
class SortArray
{
static public void main(String...alt)
{
int[] a={12,3,5,48,1,6,47};
out.println("Before Sorting : ");
for(int x:a)
out.print(x+" ");
Arrays.sort(a);
out.println("\n\nAfter Sorting : ");
for(int x:a)
out.print(x+" ");
}
}
import java.util.Arrays;
class SortArray
{
static public void main(String...alt)
{
int[] a={12,3,5,48,1,6,47};
out.println("Before Sorting : ");
for(int x:a)
out.print(x+" ");
Arrays.sort(a);
out.println("\n\nAfter Sorting : ");
for(int x:a)
out.print(x+" ");
}
}
0 Comment to "Java Program to sort primitive Array Elements with default natural sorting order."
Post a Comment