private static int parseArgs(String[] args, HamaConfiguration conf,
			BSPJob bsp) {
		conf.set(inputMatrixAPathString, args[0]);
		conf.setInt(inputMatrixARows, Integer.parseInt(args[1]));
		conf.setInt(inputMatrixACols, Integer.parseInt(args[2]));
		conf.set(inputMatrixBPathString, args[3]);
		conf.setInt(inputMatrixBRows, Integer.parseInt(args[4]));
		if (Integer.parseInt(args[2]) != Integer.parseInt(args[4])) {
			System.out.println("Matrices size do not match.");
			return 1;
		}
		conf.setInt(inputMatrixBCols, Integer.parseInt(args[5]));
		bsp.setOutputPath(new Path(args[6]));
		conf.set(inputMatrixCPathString, args[7]);
		if (args.length > 8) {
			bsp.setNumBspTask(Integer.parseInt(args[8]));
			if (args.length > 9) {
				int n = Integer.parseInt(args[9]);
				if ((n & (n - 1)) != 0) {
					System.out.println("The block size must be a power of two");
					return 1;
				}
				conf.setInt(blockSizeString, n);
			} else {
				/*
				 * set the size of blocks depending on the number of peers and
				 * matrices sizes
				 */
				/*
				 * let's assume square matrices : nbTasks =
				 * (PaddedRowSize/sizeBlock)^3 ,
				 */
				int rows = conf.getInt(inputMatrixARows, 4);
				int n = 2;
				/* set n as the largest power of two smaller than row/2 */
				while (n < rows / 2) {
					n *= 2;
				}
				n /= 2;

				int nbPeers = Integer.parseInt(args[8]);
				/*
				 * lower the block size to make sure every peer has at least a
				 * task
				 */
				while (Math.pow(rows / n, 3) < nbPeers) {
					n /= 2;
				}
				/* taking the future padding into account */
				n *= 2;
				System.out.println("block size :" + n);
				conf.setInt(blockSizeString, n);
			}
		} else {
			/*
			 * set the size of blocks depending on the number of peers and
			 * matrices sizes
			 */
			/*
			 * let's assume square matrices : nbTasks =
			 * (PaddedRowSize/sizeBlock)^3 ,
			 */
			int rows = conf.getInt(inputMatrixARows, 4);
			int n = 2;
			/* set n as the largest power of two smaller than row/4 */
			while (n < rows / 4) {
				n *= 2;
			}
			conf.setInt(blockSizeString, n);
			int tasks = (int) Math.pow((int) (rows / n), 3);
			System.out.println("block size :" + n);
			System.out.println("peers :" + tasks);
			bsp.setNumBspTask(tasks);
		}
		return 0;
	}