public class Solution {
/**
* 最大数
* @param nums int整型一维数组
* @return string字符串
*/
public String solve (int[] nums) {
// write code here
StringBuilder result = new StringBuilder();
for(int i = 0;i< nums.length; i++){
for(int j = i +1;j<nums.length;j++){
String a = Integer.toString(nums[i]) +Integer.toString(nums[j]);
String b = Integer.toString(nums[j]) +Integer.toString(nums[i]);
if(Integer.parseInt(a) < Integer.parseInt(b)){
int temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
}
}
for(int i = 0;i<nums.length;i++){
if(nums[0] == 0 ){
return "0";
}
result.append(nums[i]);
}
return result.toString();
}
}