SyntaxFix
Write A Post
Hire A Developer
Questions
try this one, it might be helpful for you
String arr= "[1,2]"; int[] arr=Stream.of(str.replaceAll("[\\[\\]\\, ]", "").split("")).mapToInt(Integer::parseInt).toArray();