import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
public class Asak {
public static void reorder(int [][] twoDimArray){
for(int i=0;i<2;i++){
Arrays.sort(twoDimArray[i]);
}
}
public static void main(String[] args) {
int [][] twoDimArray=new int [2][3];
Random random = new Random();
System.out.println("随机生成的数组为:");
for (int i=0;i<2;i++){
for (int j=0;j<3;j++){
twoDimArray[i][j]=random.nextInt(100);
System.out.print(twoDimArray[i][j]+"\t");
}
System.out.println();
}
reorder(twoDimArray);
System.out.println("排序后的数组为:");
for (int i=0;i<2;i++){
for (int j=0;j<3;j++){
System.out.print(twoDimArray[i][j]+"\t");
}
System.out.println();
}
}
}
随机数排序 java
最新推荐文章于 2024-07-12 17:45:22 发布