(I don't know Java.)
How about:
return (x % 100 == 11 || x % 100 == 22 || x % 100 == 33 || x % 100 == 44
|| x % 100 == 55 || x % 100 == 66 || x % 100 == 77
|| x % 100 == 88 || x % 100 == 99 || x % 100 == 00) ;
You could use a local variable to hold
x % 100
and save some typing.
I suppose you could use a
switch
or some sort of lookup table.
Also, consider this:
int x = 455 ;
int x1 = x % 10 ;
int x10 = x / 10 % 10 ;
bool b = x1 == x10 ;
So, to put that all together:
public boolean doSomeCheck(int x){ return ( x % 10 ) == ( x / 10 % 10 ) ; }