Question: ```
int arr[] = new int[10];
for(int i=0;i<10;i++){
   arr[i]=s.nextInt();
}
Arrays.sort(arr);
System.out.println(" "+Arrays.toString(arr));

```

my **input** is : 

> 
> 98 7 6 5 4 32 14 5 1 7
> 
> 
> 

my **output** is : 

> 
> [1, 4, 5, 5, 6, 7, 7, 14, 32, 98]
> 
> 
> 

but i want to print my output as **sorted number** only but not with [ ] and commas what would be the required solution

Answer: 
Just loop over the array, and print each number.

```
for (int i: arr) {
  System.out.print(i);
  System.out.print(" ");
}
System.out.println();

```
Use [replaceAll](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String)) to replace `[` and `]` with empty string:

```
System.out.println(" " + Arrays.toString(arr).replaceAll("[\\[|\\]]", ""));

```