private void checkIfElementIsInsideTheValidInterval(int number, int length) {
    if (number < 0 || number >= length) {
      throw new IllegalArgumentException("Input array contains an invalid element: " + number);
    }
  }
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