system.out.println (sort (str));
The result is 8,10,20,50,100 ;
write sort this method !
------ Solution ---------------------------------------- ----
String string = "5,3,29,15";
String [] s1 = string.split (",");
System.out.println (Arrays.toString (s1));
int [] h = new int [s1.length];
for (int i = 0; i
Arrays.sort (h);
System.out.println (Arrays.toString (h));
------ Solution ---------------------- ----------------------
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));
}
}
------ For reference only ---------- -----------------------------

------ For reference only ----------------- ----------------------
Which god help me to write ! Thank you, ah

------ For reference only ---------------------------------------

This is not to a sorting it
------ For reference only ---------------------------- -----------
this figure is not in the string inside it ? Compare ye taken out ?
------ For reference only -------------------------------------- -
this is the built-in function in java
------ For reference only -------------------------- -------------
Thank you , very good, so much the original Array package ah, just Baidu know the meaning !
------ For reference only -------------------------------------- -
Thank you !

------ For reference only ---------------------------------------
knot posted, 5,7 Building a person 20 points, thank you

------ For reference only ---------------------------------------

You do not distinguish me and you say I have a problem-solving ideas
没有评论:
发表评论