You can use regex to extract numbers from your String for example :
public static void main(String[] args) {
String str = "(1,3),(4,6),(3,6)";
Pattern pat = Pattern.compile("-?\d+");
Matcher mat = pat.matcher(str);
List<Integer> list = new ArrayList<>();
while (mat.find()) {
list.add(Integer.parseInt(mat.group()));
}
System.out.println(list);
}
This will gives you a List of int :
[1, 3, 4, 6, 3, 6]
Then you use this value in your array like you want.
EDIT
...extracts only the points to matrix array using java and then assign
it to matrix a[6][6]
Your matrix should be in this format :
v v v v v v
v v v v v v
v v v v v v
v v v v v v
v v v v v v
v v v v v v
So to do that you have to use :
public static void main(String[] args) {
String str = "(1,3),(4,6),(3,6)";
Pattern pat = Pattern.compile("-?\d+");
Matcher mat = pat.matcher(str);
int[][] a = new int[6][6];
int i = 0, j = 0;
while (mat.find()) {
if(j == 6){
i++;
j = 0;
}
a[i][j] = Integer.parseInt(mat.group());
j++;
}
System.out.println(Arrays.deepToString(a));
}
This will give you :
[[1, 3, 4, 6, 3, 6],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0]]