public static void main(String[] args) throws Exception {
		init();
	
		errorLog = new FileWriter("errorLog.txt");
	
		Thread printerThread = new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					printCnt();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		printerThread.start();
	
		Thread writerThread = new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					writer();
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		writerThread.start();
	
		int curTokenNumber = 0;
		for (int i = 0; i < threadNum; i++) {
			new Thread(new MyThread(curTokenNumber, i)).start();
			if (i % 2 == 1)
				curTokenNumber++;
		}
	
		for (int i = curTokenNumber; i < totalTokens; i++) {
			freeTokens.add(i);
		}
	}