<p><font face="宋体" size="3">
<br></font></p><p><span>从高到低将从命令行读取的一组数字进行降序排序。</span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri">import java.util.Arrays;</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri">public class ExamDemo {</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>public
static void main(String[] args) {</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>int[]
a = new int[args.length];</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><font face="Calibri"><span lang="EN-US"><span> </span></span><span lang="NO-BOK">int j, temp, i;<span> </span></span></font></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="NO-BOK"><font face="Calibri"><span> </span>for (i = 0; i < args.length; i++)<span> </span>a[i] = Integer.parseInt(args[i]);</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="NO-BOK"><font face="Calibri"><span> </span>for (i = 0; i < a.length - 1; i++){</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="NO-BOK"><font face="Calibri"><span> </span>for (j = 0; j < a.length - i - 1; j++){</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><font face="Calibri"><span lang="NO-BOK"><span> </span></span><span lang="EN-US">if (a[j] < a[j + 1]) {</span></font></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>temp
= a [j];</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>a[j]
= a[j + 1];</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>a[j
+ 1] = temp;</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>}</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>}</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>}</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>for
(i = 0; i < a.length; i++)</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>System.out.print(a[i]
+ " ");</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>System.out.println();</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri"><span> </span>}</font></span></p><p><font face="宋体" size="3">
<br></font></p><p><span lang="EN-US"><font face="Calibri">}</font></span></p><p><font face="宋体" size="3">
<br></font></p>