我用183 MB文件运行了此代码。它打印了“经过250毫秒”。
final InputStream in = new BufferedInputStream(new FileInputStream("file.txt"));final long start = System.currentTimeMillis();int cnt = 0;final byte[] buf = new byte[1000];while (in.read(buf) != -1) cnt++;in.close();System.out.println("Elapsed " + (System.currentTimeMillis() - start) + " ms");


