@Override
    public int calculateOperations() {
        int num = 1;
        ArrayList<Integer> calc = this.copyArray();

        Integer top = 0;
        Integer bot = 0;

        Boolean swapped = false;
        do {
            swapped = false;
            for (int i = 1 + bot; i != calc.size() - top; i++) {
                num++;
                if (calc.get(i - 1) > calc.get(i)) {
                    num += 2;
                    Collections.swap(calc, i - 1, i);
                    swapped = true;
                }
            }
            if (!swapped) {
                break;
            }
            top++;
            swapped = false;
            for (int i = calc.size() - 1 - top; i != bot; i--) {
                num++;
                if (calc.get(i - 1) > calc.get(i)) {
                    Collections.swap(calc, i - 1, i);
                    swapped = true;
                }
            }
            bot++;
        } while (swapped);
        return num;
    }