public static int hg_step6(int step, double[][] cost, int[] rowCover, int[] colCover, double maxCost, int[][] mask)
	{
            System.out.println("STEP 6");
		//What STEP 6 does:
		//Find smallest uncovered value in cost: a. Add it to every element of covered rows
		//b. Subtract it from every element of uncovered columns. Go to step 4.
		
		double minval = findSmallest(cost, rowCover, colCover, maxCost);
		
		//double maxval = findLargest(cost, rowCover, colCover, maxCost);
		double delta = minval;//maxCost - maxval;
		
		//System.out.println("Weight delta = " + delta + "     " + maxWeight);
		
		for (int i=0; i<rowCover.length; i++)
		{
			for (int j=0; j<colCover.length; j++)
			{
				if (rowCover[i]==1)
				{
					cost[i][j] = cost[i][j] + minval;
				}
				if (colCover[j]==0)
				{
					cost[i][j] = cost[i][j] - minval;
				}
			}
		}
		
		EdgeSet es = new EdgeSet();
		
		Float rowSmallest;
		Float val = new Float(-1);
		Float colSmallest;
		
		for(int i = 0; i < cost[0].length; i++){
//			colSmallest = new Float(Integer.MAX_VALUE);
//			for(int j = 0; j < cost.length; j++){
//				if(cost[j][i] < colSmallest && colCover[j] == 1){
//					colSmallest = new Float(cost[j][i]);
//					val = (float) ((float) (maxWeight - cost[j][i]) - originalRowLeast[i]);
//				}
//			}
			if(hasStarredAndPrimedinCol(mask, cost, i))
				p.set(i, new Float(p.get(i) + delta));
			//p.set(i, val);
		}
		
		// find q values by iterating through each row
		for(int i = 0; i < cost.length; i++){
//			rowSmallest = new Float(0/*Integer.MAX_VALUE*/);
//			for(int j = 0; j < cost[0].length; j++){
//				if(cost[i][j] >= rowSmallest && rowCover[i] == 0){
//					rowSmallest = new Float(cost[i][j]);
//					val = (float) (maxWeight - cost[i][j] - originalRowLeast[i]);
//				}
//			}
			val = new Float(0/*Integer.MAX_VALUE*/);
			for(int j = 0; j < cost[0].length; j++){
				if(array[i][j] - p.get(j) > val){
					val = (float) array[i][j] - p.get(j);
				}
			}
//			if(rowCover[i] == 0)
//				q.set(i, new Float(q.get(i) - delta));
			q.set(i, val);
		}
		
		// add to edgeset
		es.add(q, p);
		
		step = 4;
		cameFromStep6 = true;
		return step;
	}