public static Tape getTapeFromFile(File f) throws TuringException, FileNotFoundException
    {
        Tape tape = null;

        Scanner scan = new Scanner(f);
        
        int instructionCount=0;
    	try
    	{
			instructionCount = Integer.parseInt(scan.nextLine());
		}
		catch(NumberFormatException ex)
		{
			throw new TuringException("Could not import file: Number of instructions not specified.");
		}
        
        for (int i=0; i<instructionCount; i++)
        {
            scan.nextLine();
        }

        try
        {
            int dimensions = Integer.parseInt(scan.nextLine());
            if (dimensions == 1)
            {
                tape = new Tape(Simulator.ONE_DIMENSIONAL);
            }
            else if (dimensions == 2)
            {
                tape = new Tape(Simulator.TWO_DIMENSIONAL);
            }
        }
        catch (NumberFormatException ex)
        {
            throw new TuringException("Failed to open file: Tape dimension not specified.");
        }

        for (int y = 0; scan.hasNextLine(); y++)
        {
            String line = scan.nextLine();
            
            if(!line.equals(""))
            {
	            String splitter = "!";
	            String tapeHeadX = line.split(splitter, 2)[0];
	            String tapeContents = line.split(splitter, 2)[1];
	            
	            if (!tapeHeadX.equals(""))
	            {
	                int parsedInt = Integer.parseInt(tapeHeadX);
	                tape.setTapeHeadX(parsedInt);
	                tape.setTapeHeadY(y);
	            }
	
	            for (int x=0; x<tapeContents.length(); x++)
	            {
	                tape.setTapeCellSymbol(tapeContents.charAt(x), x, y);
	            }
            }
        }

        return tape;
    }