Comparator working doubt?

How the comparator is working during the return of the value.

Hi,
So this question seems tough and complex at first
but the main background just using customized sorting

that is can take input as string and
sort the string using customized sorting

ie return a+b > b+a;

for eg:
U Pass in string a as 9 and string b be as 50
so the comparator function compare
a+ b as 950
b+a as 509
return the one larger in value
so 950 will be returned.

Please refer to this code https://ide.codingblocks.com/s/203281