@Test
public void demo8(){
String s = "678912345";
char[] charArray = s.toCharArray();
for(int x = 0;x < charArray.length; x++){
for(int y =0; y<charArray.length-1;y++){
if(charArray[x]<charArray[y]){
char c = charArray[x];
charArray[x] = charArray[y];
charArray[y] = c;
}
}
}
String valueOf = String.valueOf(charArray);
System.out.println(valueOf);
}
时间: 2024-10-02 19:19:57