Well, this might be a silly problem.
I just want a faster implementation of following problem
I want to take three integer input in a single line eg:
10 34 54
One way is to make a BufferedReader and then use readLine()
which will read the whole line as a string
then we can use StringTokenizer to separate three integer. (Slow implemetation)
Another way is to use 'Scanner' and take input by nextInt() method. (Slower than previous method)
I want a fast implementation to take such type of inputs since I have to read more than 2,000,000 lines and these implementations are very slow.
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
for(i=0;iHow slow? Can you post some example code that you used, as well as timings?
以上就是Faster implementation of more than one input in a single line (Java)的详细内容，更多请关注web前端其它相关文章！