Reading Lines and Numbers

The original Cat program only worked in terms of characters. It is more useful and more usual to read whole lines, but the FileReader doesn't have methods for reading anything other than characters. We need a BufferedReader that piggy-backs on top of the FileReader.

Reading Lines and Numbers

The original Cat program only worked in terms of characters. It is more useful and more usual to read whole lines, but the FileReader doesn't have methods for reading anything other than characters. We need a BufferedReader that piggy-backs on top of the FileReader.

Reading Lines and Numbers

The original Cat program only worked in terms of characters. It is more useful and more usual to read whole lines, but the FileReader doesn't have methods for reading anything other than characters. We need a BufferedReader that piggy-backs on top of the FileReader.

Reading Lines and Numbers

Now our loop is going to read whole lines which will be returned to us as Strings (a bit like 'gets()' in C).

Reading Lines and Numbers

Now our loop is going to read whole lines which will be returned to us as Strings (a bit like 'gets()' in C).

Reading Lines and Numbers

Now our loop is going to read whole lines which will be returned to us as Strings (a bit like 'gets()' in C).

Reading Lines and Numbers

We use the readLine() method of the BufferedReader object...

Reading Lines and Numbers

We use the readLine() method of the BufferedReader object...

Reading Lines and Numbers

We use the readLine() method of the BufferedReader object...

Reading Lines and Numbers

We use the readLine() method of the BufferedReader object...

Reading Lines and Numbers

We use the readLine() method of the BufferedReader object...

Reading Lines and Numbers

...and the terminating condition is whether the returned line is null or not.

Reading Lines and Numbers

...and the terminating condition is whether the returned line is null or not.

Reading Lines and Numbers

...and the terminating condition is whether the returned line is null or not.

Reading Lines and Numbers

This is a simple line copying program which is incidentally more efficient than the char-by-char copier that we had before.

Reading Lines and Numbers

If our file consists of integers, one per line, we can convert each String to an Integer wrapper object...

Reading Lines and Numbers

If our file consists of integers, one per line, we can convert each String to an Integer wrapper object...

Reading Lines and Numbers

If our file consists of integers, one per line, we can convert each String to an Integer wrapper object...

Reading Lines and Numbers

...and then we can extract an int from the Integer wrapper.

Reading Lines and Numbers

...and then we can extract an int from the Integer wrapper.

Reading Lines and Numbers

...and then we can extract an int from the Integer wrapper.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

Of course, converting the number may throw a NumberFormatException if your line is '46.5' or 'Z' or even (alas) ' 51'.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

You may have two integers on each line, so you will need to break up the line with a StringTokenizer (see the class library documentation for java.util.StringTokenizer for the complete story.

Reading Lines and Numbers

Let's make this more complicated: the second number on each line is a double!

Reading Lines and Numbers

Let's make this more complicated: the second number on each line is a double!

Reading Lines and Numbers

Let's make this more complicated: the second number on each line is a double!

Reading Lines and Numbers

Let's make this more complicated: the second number on each line is a double!

Reading Lines and Numbers

Let's make this more complicated: the second number on each line is a double!

Reading Lines and Numbers

And just to be on the safe side, the tokenizer will throw an exception if you don't put two tokens on each line! Tag another catch slause onto the existing try clause.

Reading Lines and Numbers

And just to be on the safe side, the tokenizer will throw an exception if you don't put two tokens on each line! Tag another catch slause onto the existing try clause.

Reading Lines and Numbers

And just to be on the safe side, the tokenizer will throw an exception if you don't put two tokens on each line! Tag another catch slause onto the existing try clause.

Reading Lines and Numbers

Finished code.

import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);

		int c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);

		int c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		int c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		int c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		int c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=in.read())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=-1)
			System.out.print((char)c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=-1)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=-1)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=-1)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null)
			System.out.println(c);
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			Integer bigI=new Integer(c);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			Integer bigI=new Integer(c);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			Integer bigI=new Integer(c);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			Integer bigI=new Integer(c);
			int littleI=bigI.intValue();

			System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			Integer bigI=new Integer(c);
			int littleI=bigI.intValue();

			System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			*Integer bigI=new Integer(c);
			int littleI=bigI.intValue();

			System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			int littleI=bigI.intValue();

			System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			*int littleI=bigI.intValue();

			System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			*System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
*			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
*import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    *Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(c);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    *System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    int otherI=new Integer(st.nextToken()).intValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    int otherI=new Integer(st.nextToken()).intValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    int otherI=new Integer(st.nextToken()).intValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Integer(st.nextToken()).intValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Integer(st.nextToken()).intValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Double(st.nextToken()).doubleValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Double(st.nextToken()).doubleValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Double(st.nextToken()).doubleValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Double(st.nextToken()).doubleValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			catch(NoSuchElementException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}
import java.util.*;
import java.io.*;

public class Cat{

public static void main(String[] arg){
	for(int i=0; i < arg.length; i++){
	    try{
		File f=new File(arg[i]);
		Reader in=new FileReader(f);
		BufferedReader br=new BufferedReader(in);

		String c;
		while((c=br.readLine())!=null){
			try {
			    StringTokenizer st=new StringTokenizer(c);

			    String s=st.nextToken();
			    Integer bigI=new Integer(s);
			    int littleI=bigI.intValue();

			    double otherD=new Double(st.nextToken()).doubleValue();
			    System.out.println(littleI*2);
			    }
			catch(NumberFormatException e){System.err.println(e);}
			catch(NoSuchElementException e){System.err.println(e);}
			}
		}
	    catch(IOException e){System.err.println(e);}
	    }
	}
}