Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement