// read from the file with buffering // and with direct access to the buffer MyTimer mt = new MyTimer(); FileInputStream fis = new FileInputStream(TESTFILE); cnt3 = 0; final int BUFSIZE = 1024; byte buf[] = new byte[BUFSIZE]; int len; while ((len = fis.read(buf)) != -1) { for (int i = 0; i < len; i++) { if (buf[i] == 'A') { cnt3++; } } } fis.close(); System.out.println("read3 time = " + mt.getElapsed()); }