title: Reading Integer user input in DataInputStream in java?
body: <p>I am trying to get input from user using <code>DataInputStream</code>. But this displays some junk integer value instead of the given value.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import java.io.*;
  public class Sequence {
      public static void main(String[] args) throws IOException {
      DataInputStream dis = new DataInputStream(System.in);
      String str="Enter your Age :";
      System.out.print(str);
      int i=dis.readInt();
      System.out.println((int)i);
      }
  }
  </code></pre>
  
  <p>And the output is </p>
  
  <blockquote>
    <p>Enter your Age :12</p>
    
    <p>825363722</p>
  </blockquote>
  
  <p>Why am I getting this junk value and how to correct the error?</p>