import java.util.*;
public class Solution { /** * 最大数 * @param nums int整型一维数组 * @return string字符串 */ public String solve (int[] nums) { // write code here if(nums == null || nums.length == 0) return ""; int n = nums.length; String[] strs = new String[n]; for(int i = 0; i < n; i++){ strs[i] = nums[i]+""; } Arrays.sort(strs,(s1,s2)->{ return (s2+s1).compareTo(s1+s2); /降序排序/ }); if(strs[0].equals("0")) return "0"; StringBuffer sb = new StringBuffer(); for(String num:strs) sb.append(num); return sb.toString(); } }