日期:2014-05-20 浏览次数:20582 次
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));
}
}