Programing exercise
<p>Hi I have been doing the Javabat exercises and I have found myself in a bit of a snag with this problem:</p>

<p>We'll say that a String is xy-balanced if for all the 'x' chars in the string, there exists a 'y' char somewhere later in the string. So "xxy" is balanced, but "xyx" is not. One 'y' can balance multiple 'x's. Return true if the given string is xy-balanced. </p>

<pre><code>xyBalance("aaxbby") → true

xyBalance("aaxbb") → false

xyBalance("yaaxbb") → false
</code></pre>

<hr>

<pre><code>public boolean xyBalance(String str) {

  if(str.length() &lt; 2){

    if(str == "x"){

    return false;

    }

    return true;

  }

  for (int i = 0 ; i &lt; str.length()- 1;i++){

  if (str.charAt(i)=='x' &amp;&amp; str.charAt(i + 1) == 'y'){

  return true;

  }

  }

  return false;
}
</code></pre>
