Your array currently store
[0] -> 90000,5,4
[1] -> 90000
[2] -> 5
That is why you are seeing as output [90000,5,4,90000,5]
. It is because group(0)
represents entire match so it returns 90000,5,4
.
What you need is match from groups 1, 2 and 3.
(\\d+),(\\d+),(\\d+)
1 2 3
So change
rtn[i] = matcher.group(i);
to
rtn[i] = matcher.group(i+1);