static public void main(String args[]) {

		int fm[][] = new int[8][8];

		if ( args.length != 1 ) {
			System.out.println("usage: java DCT <matrix-filename>");
			return;
		}

		File f = new File(args[0]);
		if ( !f.canRead() ) {
			System.out.println("Error! can't open "+args[0]+" for reading");
			return;
		}
		try {
			BufferedReader br = new BufferedReader(new FileReader(f));
			for ( int i = 0; i < 8; i++ ) {
				String line = br.readLine();
				StringTokenizer tok = new StringTokenizer(line,", ");
				if ( tok.countTokens() != 8 ) {
					System.out.println("Error! File format error: 8 tokens required!");
					throw new IOException("Error");
				}
				for ( int j = 0; j < 8; j++ ) {
					String numstr = tok.nextToken();
					int num = Integer.parseInt(numstr);
					fm[i][j] = num;
				}
			}
		}
		catch ( FileNotFoundException e ) {
			System.out.println("Error! can't create FileReader for "+args[0]);
			return;
		}
		catch ( IOException e ) {
			System.out.println("Error! during read of "+args[0]);
			return;
		}
		catch ( NumberFormatException e ) {
			System.out.println("Error! NumberFormatExecption");
			return;
		}

		DCT dct = new DCT(fm);
		dct.transform();
		dct.printout();
		dct.inverse();
		dct.printoutinv();
	}