title: Why is Scanner slower than BufferedReader when reading from input?
body: <p>I understand what is Scanner good for, and also when to use Scanner and when BufferedReader.
  I read a different, yet in some therm similar question <a href="https://stackoverflow.com/questions/2231369/scanner-vs-bufferedreader">Scanner vs. BufferedReader</a></p>
  
  <p><strong>Why is Scanner so slow when I read from the input?</strong>
  I assume it has to do with that there is a small buffer in Scanner, but here I am lost.
  The original problem is from,  <a href="http://www.codechef.com/problems/INTEST" rel="noreferrer">Codechef</a> , but I am not interested in that solution.</p>
  
  <p>Here is a code example with a given input:
  Input:</p>
  
  <ul>
  <li>7 3 </li>
  <li>1</li>
  <li>51</li>
  <li>966369 </li>
  <li>7</li>
  <li>9</li>
  <li>999996 </li>
  <li>1</li>
  </ul>
  
  <p>And the code</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.InputStreamReader;
  
  public class Main {
  
      public static void main(String[] args) throws Exception {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          String[] s = br.readLine().split(" "); 
          int numberOfLines = Integer.parseInt(s[0]);
          int divideNumber = Integer.parseInt(s[1]);
          int count = 0;
  
          for (int i = 0; i &lt; numberOfLines; i++) {
              String number = br.readLine();
              if (number.length() &lt; 11) {
                  int num = Integer.parseInt(number);
                  if (num % divideNumber == 0) {
                      count++;
                  }
              } 
          }
          System.out.println(count);
      }
  }
  </code></pre>
  
  <p>If I read the same code with scanner it is slow. </p>