specialEleven java challenge

Hi,
I am trying below challenge

http://codingbat.com/prob/p100962

I tried as  below
public boolean specialEleven(int n) {

if(Integer.mod((n%11)==0))
return true;

else
return false;
  
}

Open in new window


I am getting below error


Compile problems:


Error:      if(Integer.mod((n%11)==0))
                 ^^^
The method mod(boolean) is undefined for the type Integer



please advise
LVL 7
gudii9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gudii9Author Commented:
public boolean specialEleven(int n) {

if((n%11)==0){
return true;
}

else{
return false;
}
  
}

Open in new window



above passed below test still many failures there
Expected	Run		
specialEleven(22) → true	true	OK	    
specialEleven(23) → true	false	X	    
specialEleven(24) → false	false	OK	    
specialEleven(21) → false	false	OK	    
specialEleven(11) → true	true	OK	    
specialEleven(12) → true	false	X	    
specialEleven(10) → false	false	OK	    
specialEleven(9) → false	false	OK	    
specialEleven(8) → false	false	OK	    
specialEleven(0) → true	true	OK	    
specialEleven(1) → true	false	X	    
specialEleven(2) → false	false	OK	    
specialEleven(121) → true	true	OK	    
specialEleven(122) → true	false	X	    
specialEleven(123) → false	false	OK	    
specialEleven(46) → false	false	OK	    
specialEleven(49) → false	false	OK	    
specialEleven(52) → false	false	OK	    
specialEleven(54) → false	false	OK	    
specialEleven(55) → true	true	OK	    
other tests
X	  

Open in new window


not sure on how to use mod method. Which object it is defined?
I saw one example here not sure how to use that in our context here

http://www.tutorialspoint.com/java/math/biginteger_mod.htm
ozoCommented:
public boolean specialEleven(int n) {
    return n%11<=1;
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
krakatoaCommented:
Or ...
  return 2>n%11;

Open in new window

Webinar: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. Join us in our upcoming webinar as we discuss how to best defend against these attacks!

Jim CakalicSenior Developer/ArchitectCommented:
Not the shortest but also correct:
  return n%11==0 || (n-1)%11==0;

Open in new window

krakatoaCommented:
Or,

return n%11-2<0;

Open in new window

gudii9Author Commented:
how do i say ignore sign whether it is positive or negative?
ozoCommented:
Math.abs

but you already have a given non-negative number
gudii9Author Commented:
Math.abs this is what i forgot and looking
gudii9Author Commented:
public boolean in1To10(int n, boolean outsideMode) {

if(n<=10&&n>=1 && outsideMode==false ){

return true;
}

else if(n<=1&&outsideMode==true){

return true;
}


else if(n>=10&&outsideMode==true){

return true;
}


  else 
  return false;
}

Open in new window


in the same lines i fixed my original code which passes all tests
krakatoaCommented:
You sure your last post was meant for this question?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.