Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1.   static boolean haakjescorrect(String zin) {
  2.     counter = 0;
  3.     for (int i = 0; i < zin.length; i++) {
  4.       if (zin.charAt(i) == '(')
  5.         counter++;
  6.       if (zin.charAt(i) == ')')
  7.         counter--;
  8.       if (counter < 0)
  9.         return false;
  10.     }
  11.     if (counter == 0)
  12.       return true;
  13.     else
  14.       return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement