I do not know about Android, but at least on JavaSE, the scanner runs slowly.
Inside, the scanner does the UTF-8 conversion, which is useless in a file with floats.
Since all you want to do is read the floats from the file, you have to go with the java.io package.
The guys at SPOJ are struggling with I / O. This is the site of the Polish competition for programmers with very complex problems. Their difference is that they accept a wider range of programming languages โโthan other sites, and in many of their problems the input is so large that if you do not write efficient I / O, your program will burst.
Check your forums, for example here , for the idea of โโa custom parser.
Of course, I advise you not to write your own float parser, but if you need speed, this is still a solution.
Leonel Mar 15 '10 at 12:03 2010-03-15 12:03
source share