-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path32.java
26 lines (25 loc) · 921 Bytes
/
32.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class Solution {
public String PrintMinNumber(int [] numbers) {
if(numbers==null || numbers.length<=0) return "";
ArrayList<Integer> num=new ArrayList<Integer>();
for(int i:numbers)0
num.add(i);
//用Collections进行排序
Collections.sort(num,new Comparator<Integer>()
{
public int compare(Integer st1,Integer st2)
{
String t1=st1+""+st2;
String t2=st2+""+st1;
return t1.compareTo(t2);
}
});
String result="";
for(int i=0;i<num.size();i++)
result+=num.get(i);
return result;
}
}