public static void main(String[] args) { int[] numbers = new int[]{32,1,321}; String[] nums = new String[3]; for(int i =0; i< numbers.length; i++){ nums[i] = numbers[i] + ""; } Arrays.sort(nums,(s1,s2)->(s1+s2).compareTo(s2+s1)); System.out.println(nums); }