Can anyone help me out why this comparator is not working
class sortClass implements Comparator
{
public int compare(Integer a, Integer b)
{
int ab = attachNumber(a,b);
int ba = attachNumber(b,a);
if(ab>ba)
{
return -1;
}
else
{
return 1;
}
}
public int attachNumber(int a, int b)
{
int tens = 1;
while(b>tens)
{
tens=tens*10;
}
a=a*tens+b;
return a;
}
}