标签:
package org.demo; import java.util.Random; public class DemoRanddom { public static void main(String[] args) { int parm[] = new int[10]; Random random = new Random(); for (int i = 0; i < 10; i++) { int j=random.nextInt(50)+1; parm[i]=j; } for(int i=0;i<parm.length;i++){ for (int j = i+1; j < parm.length; j++) { int temp; if(parm[i]>parm[j]){ temp=parm[i]; parm[i]=parm[j]; parm[j]=temp; } } } for (int i = 0; i < parm.length; i++) { System.out.print(parm[i]+" "); } } }
标签:
原文地址:http://www.cnblogs.com/liuhuanping/p/4380307.html