Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static boolean haakjescorrect(String zin) {
- counter = 0;
- for (int i = 0; i < zin.length; i++) {
- if (zin.charAt(i) == '(')
- counter++;
- if (zin.charAt(i) == ')')
- counter--;
- if (counter < 0)
- return false;
- }
- if (counter == 0)
- return true;
- else
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement