What is wrong in the code passig only two test cases

Scanner scn = new Scanner(System.in);
	int x=scn.nextInt();
	revno(x);
}
public static void revno(int x)
{
	int ans=0;
	while(x!=0)
	{
	int rem=x%10;
	ans=ans*10+rem;
	x=x/10;
	}
	add(ans);
}
public static void add(int ans)
{
	int d=0;
	while(ans!=0)
	{
		d=ans%10;
		int s=(9-d);
		if(s>d)
		{
			System.out.print(d);
		}
		else
		{
			System.out.print(s);
		}
		ans=ans/10;
	}
}

}

for input 99
output should be 90
Try to debug with this