Discuss / Java / 作业 8 / 1000

作业 8 / 1000

Topic source

Faraam法汉

#1 Created at ... [Delete] [Delete and Lock User]

直接照搬例题了。。

// TODO:

        for (int i = 0; i < ns.length - 1; i++) {

            for (int j = 0; j < ns.length - i - 1; j++) {

                if (ns[j] < ns[j+1]) {

                    // 交换ns[j]和ns[j+1]:

                    int tmp = ns[j];

                    ns[j] = ns[j+1];

                    ns[j+1] = tmp;

}

}

}


  • 1

Reply