public static void main(String[] args) {
        int[] data = {10, 20, 150, 40, 2};

        for (int barrier = 0; barrier < data.length-1; barrier++) {
            for (int index = data.length - 1; index > barrier; index--) {
                if (data[index] < data[index - 1]) {
                    swap (data, index);
                }
            }
        }

        System.out.println(Arrays.toString(data));

    }