Advertisement
Guest User

Simple IntIO

a guest
Oct 25th, 2015
320
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class IntIO extends BufferedInputStream
  2. {
  3.     public IntIO(final InputStream in)
  4.     {
  5.         super(in);
  6.     }
  7.  
  8.     public IntIO(final InputStream in, final int buf_size)
  9.     {
  10.         super(in, buf_size);
  11.     }
  12.  
  13.     public int getInt() throws IOException
  14.     {
  15.         int chr = read();
  16.         while(chr<=' ') chr = read();
  17.         int sum = chr-'0';
  18.         while((chr = read())>' ') sum = (sum<<3)+sum+sum + chr-'0';
  19.         return sum;
  20.     }
  21. }
Advertisement
RAW Paste Data Copied
Advertisement