public static boolean[] nextPosition(boolean switches[], int numTrue){
		String value = "";
		boolean retSwitches[] = new boolean [switches.length]; 
		for(int i = 0; i < switches.length; i++){
			value += switches[i] == true ? 1 : 0;
			
		}
		value = value.replaceAll( "[^\\d]", "" );
		int currentValue = Integer.parseInt(value,2);
		int count = 0;
		do{
			currentValue += 1;
			//System.err.println("currentValue = " + currentValue);
			String test = new String(Integer.toBinaryString(currentValue) + "");
			//System.err.println("currentValue = " + test);
			int length = test.length();
			test = test.replaceAll("1", "");
			if(length - test.length() == numTrue) break; 
		}while(count < 100);
		
		//System.out.println("Next value is " + Integer.toBinaryString(currentValue));
		String reverseSwitch = Integer.toBinaryString(currentValue) + "";
		int j = switches.length-1;
		for(int i = reverseSwitch.length()-1; i >= 0; i--){
			//System.err.println("i" + i + " revSw:" + reverseSwitch + " value =" + (reverseSwitch.charAt(i) == '1' ? true: false) + " char = "  + reverseSwitch.charAt(i));
			retSwitches[j] = (reverseSwitch.charAt(i) == '1' ? true: false);
			j--;
		}
		for(; j >=0 ; j--) retSwitches[j] =false;
		
		
//		System.out.println("results : " );
//		for(boolean i : retSwitches){
//			System.out.print( i == true ? "1" : "0");
//		}
		//System.out.println("Value:" +  Integer.toBinaryString(Integer.parseInt(value,2)) + " from " + value + " from " + Integer.parseInt(value,2));
		
		return retSwitches;
	}