title: program to find if two characters in String in a row are digits does not work in java
body: <p>I have the code below, which I want to take input from the keyboard and show me  if the input contains 2 digits in a row. If so, I want to get <code>false</code> printed out in the console, otherwise <code>true</code>. It works fine, except when the first 2 characters of the input are digits. In that case, I still get <code>true</code> in the console. Can anyone understand why? Thanks in advance</p>
  
  <pre><code>import java.util.Scanner;
  public class Test {
      public static void main(String[] args) {
          Scanner sc = new Scanner(System. in );
          System.out.println("Enter:");
          String s = sc.nextLine();
          if (checkDigit(s)) {
              System.out.println("false");
          } else {
              System.out.println("true");
          }
      }
      public static boolean checkDigit(String s) {
          boolean b = true;
          char[] c = s.toCharArray();
          for (int i = 0; i &lt; c.length - 1; i++) {
              if (Character.isDigit(c[i]) &amp;&amp; Character.isDigit(c[i + 1])) {
                  b = true;
              } else {
                  b = false;
              }
          }
          return b;
      }
  }
  </code></pre>