swapHalfStr method
Inverts the order of the first half and the second half of array
in place.
Implementation
static void swapHalfStr(List<String> array) {
int right;
String temp;
int halfsize = array.length ~/ 2;
// reverse 1st half of array
for (int i = 0; i < halfsize ~/ 2; i++) {
right = halfsize - 1 - i;
temp = array[i];
array[i] = array[right];
array[right] = temp;
}
// reverse 2nd half of array
for (int i = 0; i < halfsize ~/ 2; i++) {
right = array.length - 1 - i;
temp = array[halfsize + i];
array[halfsize + i] = array[right];
array[right] = temp;
}
}