62,616
社区成员
发帖
与我相关
我的任务
分享
package com.xiaomihu.java;
import java.util.*;
public class Test {
public static void main(String[] args) {
String str = "10, 8, 20, 100, 50";
String[] arr = str.split(",");
int[] temp = new int[arr.length];
for(int i = 0; i < arr.length; i++) {
temp[i] = Integer.parseInt(arr[i].trim());
}
Arrays.sort(temp);
System.out.println(Arrays.toString(temp));
}
}