Nothing will do this automatically for you AFAIK. You will need to start by extracting the data. Depending on how it is provided to you, you can use regular expressions or some specialized parser (if it is XML, there is a wide range of Java tools there).
Next, you will need to separate this String coordinate. Check the split
method of the String
class.
Finally, these coordinates must become integer. Check the parseInt
method of the Integer
class.
Using these numeric coordinates, you can insert a value into an array. If you know the maximum coordinates in advance, you can immediately create an array. If the coordinates can be any values without restrictions, you will need some kind of dynamic structure or regularly create a larger array and copy over the old contents.
source share