public void splitSwappingRecursive(int[] array) {
    if (array == null) {
      throw new IllegalArgumentException("Array passed as parameter can't be null.");
    }

    if (array.length == 0) {
      return;
    }

    splitSwappingRecursiveInner(array, 0, array.length - 1);
  }
This is a tail recursive solution for this problem. This implementation has the same time complexity,
O(N). Here, the only change is how we are going to iterate over the array; in the previous
implementation we used a classic iterative approach whereas in this solution we are using
recursion to iterate. In this case, the space complexity is also O(1) because we are not using any additional data
structure.
src/main/java/com/github/pedrovgs/problem8/SplitArray.java