Good evening, to change from crescent to decreasing in your code, simply change the condition aux < v[j]
to aux > v[j]
For example:
private static void shellsort(int v[], int n, boolean crescente) {
int i, j, aux, h = 1;
do
h = 3 * h + 1;
while (h < n);
do {
h /= 3;
for (i = h; i < n; i++) {
aux = v[i];
j = i - h;
if (crescente) {
while (j >= 0 && aux < v[j]) {
v[j + h] = v[j];
j -= h;
}
} else {
while (j >= 0 && aux > v[j]) {
v[j + h] = v[j];
j -= h;
}
}
v[j + h] = aux;
}
} while (h > 1);
}