Java tutorial
//package com.java2s; //License from project: Apache License public class Main { private static int getPossiblyTagCount(String Line) { String strCount1[] = Line.split("\\["); String strCount2[] = Line.split("\\]"); if (strCount1.length == 0 && strCount2.length == 0) return 1; else if (strCount1.length > strCount2.length) return strCount1.length; else return strCount2.length; } }