我写的Java源代码是这样的:
import java.util.*;
public class SortTest 
{
      static int []y ;

      public static void main(String[] args)
      {
  int []x= new int[]{7,65,83,1092,0,-2,877,63,838838,-3765};

  java.util.Arrays.sort(x);                //对数组进行排序,其实在此处也可写成 Arrays.sort(x)
  System.out.println(Arrays.asList(x));    // 打印输出数组
           
           System.out.println("该数组从大到小的排列顺序是:");
        
           for(int counter = x.length-1;counter>=0;counter --)
           {
                 int i = 0;                  if(i <=x.length-1)
                 { 
                       i++;
                 }            y[i] = x[counter];
            System.out.println("/ny[" + counter + "]=" + y[i]);
            }

}
}在Eclipse3.2里面运行的结果是:java.lang.NoClassDefFoundError: 17
Caused by: java.lang.ClassNotFoundException: 17
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main" 求高手指点啊,小弟分少,就悬10分,希望不吝赐教啊!!!

解决方案 »

  1.   

    这样不就行了么 ,搞那么多我不知道你想干什么、?/
        public static void main(String[] args)
        {
            int[] x = new int[] { 7, 65, 83, 1092, 0, -2, 877, 63, 838838, -3765 };        java.util.Arrays.sort(x); //对数组进行排序,其实在此处也可写成 Arrays.sort(x) 
            
            for(int i = 0; i < x.length; i++)
            {
                System.out.println(x[i]);
            }
        }
      

  2.   

    错在y[i] = x[counter];这一句.数组y还没有初始化就开始赋值了
      

  3.   

    /**
     * @param int型数组
     *            将int类型的数组元素按从大到小顺序排列
     */
    public void reSort(int[] a) {
    int temp;
    Arrays.sort(a);
    for (int i = 0; i < a.length / 2; i++) {
    temp = a[i];
    a[i] = a[a.length - 1 - i];
    a[a.length - 1 - i] = temp;
    }
    }
      

  4.   

    数组排序可以直接用Arrays.sort()方法你的程序没有初始化数组yint[] x = new int[]{7,65,83,1092,0,-2,877,63,838838,-3765};
    y = new int[x.length - 1];
      

  5.   

    非常感谢各位,学到东西了!
    其实我写这个程序的作用是将数组从大到小(sort方法是将数组从小到大排列的)输出,然后测试一下 asList 方法
      

  6.   

    static int []y ; 
    //这样写比较好
    static int[] y=new int[10];
      

  7.   

        要实现从大到小排序,只需要 用一楼的方法将数组 从小到大排序 后,
     
         用一个for 循环 ,假设 有一数组 a[n] (已经 从小到大 排好序):
      
                int t=0;
                
                for(int i=0;i<a.length/2;i++){
     
                   t=a[i];
                  
                   a[i]=a[n-i-1];               a[n-i-1]=t;
      
               }
          你试一下 ,我没调试,但算法是对的 。
                    
      

  8.   

    实现接口就OK了~~~~http://bbs.tsp2c.cn/?fromuid=136 可以参考下