title: How to check if a String contains close group brackets in Java
body: <p>How to checks a string for correct grouping. For instance, the following groups are done correctly:</p>
  
  <pre><code>({})
  [[]()]
  [{()}]
  </code></pre>
  
  <p>The next are done incorrectly:</p>
  
  <pre><code>{(})
  ([]
  [])
  </code></pre>
  
  <p>A correct string cannot close groups in the wrong order, open a group but fail to close it, or close a group before it is opened.</p>
  
  <p>The input string that may contain any of the symbols "()" "{}" or "[]" to create groups. The output return <code>True</code> if the string is empty or otherwise grouped correctly, or <code>False</code> if it is grouped incorrectly.</p>
  
  <p>May anyone give me some hint with this.</p>