正規表現に基づいて文字列を分割するのに問題があります。
String str = "1=(1-2,3-4),2=2,3=3,4=4";
Pattern commaPattern = Pattern.compile("\\([0-9-]+,[0-9-]+\\)|(,)") ;
String[] arr = commaPattern.split(str);
for (String s : arr)
{
System.out.println(s);
}
期待される出力、
1=(1-2,3-4)
2=2
3=3
4=4
実際の出力、
1=
2=2
3=3
4=4