private void validateInput(int[] array) {
    if (array == null) {
      throw new IllegalArgumentException("You can't pass a null array as input.");
    }
    int arraySize = array.length;
    for (int i = 0; i < arraySize; i++) {
      checkIfElementIsInsideTheValidInterval(array[i], arraySize);
    }
  }
Iterative solution to solve this problem. This is a bubble sort algorithm and the complexity
order of this algorithm is O(N^2). In space terms, the complexity order is O(1). I've used
this algorithm to resolve this problem because in the problem statement says you can't use any
additional data structure.
src/main/java/com/github/pedrovgs/problem40/MoveElementsToPositions.java