java
class Solution {
public String largestNumber(int[] nums) {
int len = nums.length;
for (int i = 0; i < len-1; i++) {
for (int j = i+1; j < len; j++) {
String str1 = ""+nums[j]+nums[i];
String str2 = ""+nums[i]+nums[j];
if(Long.parseLong(str1)>Long.parseLong(str2)){
int tmp = nums[i];
nums[i]=nums[j];
nums[j] = tmp;
}
}
}
if(nums[0]==0)
return "0";
StringBuffer sbf = new StringBuffer();
for (int i = 0; i < len; i++) {
sbf.append(nums[i]);
}
return sbf.toString();
}
}