Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean xyBalance(String str) {
- int count;
- int locx;
- int locy;
- boolean output;
- for(int i=0;i<str.length();i++){
- if(str.charAt(i)=='x'){
- count++;
- locx = i;
- }
- }
- if(count>0){
- output = true;
- for(int i=locx;i<str.length();i++){
- if(str.charAt(i)=='y')
- locy = i;
- }
- for(int i=locy;str.length();i++){ //error line
- if(str.charAt(i)=='x')
- output = false;
- }
- }
- else output = false;
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement