SHARE
TWEET

Untitled

a guest Dec 15th, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public boolean xyBalance(String str) {
  2.   int count;
  3.   int locx;
  4.   int locy;
  5.   boolean output;
  6.   for(int i=0;i<str.length();i++){
  7.     if(str.charAt(i)=='x'){
  8.       count++;
  9.       locx = i;
  10.     }
  11.   }
  12.   if(count>0){
  13.     output = true;
  14.     for(int i=locx;i<str.length();i++){
  15.       if(str.charAt(i)=='y')
  16.         locy = i;
  17.     }
  18.     for(int i=locy;str.length();i++){   //error line
  19.       if(str.charAt(i)=='x')
  20.         output = false;
  21.     }
  22.   }
  23.   else output = false;
  24.  
  25.   return output;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top