For this Question: Bob has a list of N numbers. He defines the strength of a number as the sum of all it's digits. If two numbers have the same sum of digits then the greater number will have more strength. For example : 62 and 143 has the same digit sum = 8, but 143 &gt; 62 so the strength of 143 is higher than 62.

Bob wants to arrange the numbers in a line such that they are in increasing order of their strength.First line contains N.
Next line contains N space separated integers.

<b>Constraints</b>
1 &le; N &le; 10<sup>5</sup>
1 &le; numbers &le; 10<sup>9</sup>Print N space separated integers denoting the required arrangement.Input:
5
12 7 61 99 21

Output:
12 21 7 61 99

Explanation:
numbers => 12 21 7 61 99
strength => 3 3 7 7 18, I have written this Solution Code: import java.io.*;
import java.util.*;


class SortByStrength implements Comparator<Integer>{
    public int compare(Integer a,Integer b){
        int x1=digitSum(a);
        int x2=digitSum(b);
        if(x1==x2){
            if(a<b)return -1;
            return 1;
        }
        if(x1<x2)return -1;
        return 1;
    }
    private int digitSum(int x){
        int sum=0;
        while(x>0){
            sum += (x%10);
            x/=10;
        }
        return sum;
    }
}

public class Main {
     
    public static void main(String[] args) {
        
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        
        int n=Integer.parseInt(in.next());
        
        Integer a[] = new Integer[n];
        for(int t=0;t<n;t++){
            a[t] = Integer.parseInt(in.next());
        }
        
        Arrays.sort(a, new SortByStrength());
        
        for(int i=0;i<n;i++){
            out.print(a[i] + " ");
        }
        out.close();
    }

    
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?