Java loop array
Scanner scanner = new Scanner( System.in );
int n = scanner.nextInt();
int[] a=new int[ n + 1 ];
for( int k = 1; k <= n; k ++ ){
a[ k ] = scanner.nextInt();
}
Arrays.sort( a );
for( int k = 1; k <= n; k ++ ){
System.out.print( a[k] + " " );
}