int[] aux = new int[a.length];
for(int i = lo; i <= hi; i++) {
aux[i] = a[i];
}
int i = lo;
//what is missing here?
for(int k = lo; k <= hi; k++) {
if(i > mid) a[k] = aux[j++];
else if(i > hi) a[k] = aux[i++];
else if(aux[i] >= aux[j]) a[k] = aux[j++];
else a[k] = aux[i++];
}
}
private void sort(a[] a, int lo, int hi) {
if(lo >= hi) return;
int mid = lo + (hi - lo)/2;
sort(a, lo, mid);
sort(a, mid + 1, hi);
merge(a, lo, mid, hi);
}
public void sort(a[] a) {
sort(a, 0, a.length - 1);
}