public void move(int[] array) {
    validateInput(array);
    int size = array.length;
    boolean swap = true;
    while (swap) {
      swap = false;
      for (int i = 0; i < size - 1; i++) {
        if (array[i] > array[i + 1]) {
          swap = true;
          swapElements(array, i, i + 1);
        }
      }
    }
  }
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