I have a question about optimization of my code (which works but is too slow...). I am reading an input in a form
X1 Y1
X2 Y2
etc
where Xi, Yi are integers. I am using bufferedReader
for reading lines and then StringTokenizer
for processing those numbers like this:
StringTokenizer st = new StringTokenizer(line, " ");
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
The problem is that this approach seems time inefficient when coping with large data sets. Could you suggest me some simple improvement (I have heard that some integer parse int or regex can be used) which would improve the performance? Thanks for any tips
EDIT: Perhaps I misjudged myself and some improvements have to be done elsewhere in the code...