Problems with the size of inputs, java noob
<pre><code>import java.lang.StringBuffer;
import java.util.Scanner;
public class test {

   public static void main(String[] args) {
      StringBuffer sb = new StringBuffer();
      Scanner scan = new Scanner(System.in);
      System.out.print("Enter number to be reversed: ");
      int x = scan.nextInt();
      Integer number = new Integer(x);
      String reverse = new String();

      for(int i = 0; i &lt;= number.toString().length()-1; i++) {
         reverse = new StringBuffer(reverse).insert(i, number.toString().charAt(number.toString().length()-(1+i))).toString();
      }

      System.out.println(reverse);
   }
}
</code></pre>

<p>I have this code, the problem is that any imput over 9 digits will raise an error:</p>

<pre><code>Exception in thread "main" java.util.InputMismatchException: For input string: "4444444444"
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at test.main(test.java:9)
</code></pre>

<p>Does anyone know why this is the case?</p>
