Here\'s a method for sorting an integer array. How can I remove the last separator form the output?
public void Sort(int[] sort) { for (int a:sort) {
Easily can do like below:
for (int i = 0; i < sort.length; i++) { System.out.print(i < sort.length-1 ?sort[i]+", " : sort[i]+""); }