import java.util.Arrays;
public class Text_10 {
public static void main(String[] args) {
//有一个字符串91 27 46 38 50,请写代码输出27 38 46 50 91
String string ="91 27 46 38 50";
char [] arr=string.toCharArray();
int[]arr2=new int[arr.length];
for (int i = 0; i < arr.length; i++) {
arr2[i]=arr[i];
}
Arrays.sort(arr2);
for (int i = 0; i < arr2.length; i++) {
System.out.print(arr2[i]);
}
}
}
输出结果是
3232323248495051525354555657 |
|