public byte convertBitsToValue(byte org,int startBit, int endBit, boolean value){
		System.out.println("StartBit="+startBit+"/endBit="+endBit);
		
		int mask1 = (255 >> startBit); //for above example, mask 1 = 00000011;
		System.out.println("mask1="+String.format("%8s", Integer.toBinaryString(mask1)).replace(' ', '0'));
		int mask2 = (255 >> (endBit+1)); //for above example, mask 2 = 00111111;
		System.out.println("mask2="+String.format("%8s", Integer.toBinaryString(mask2)).replace(' ', '0'));
		int mask = (mask1 ^ mask2); // mask = 00111100;
		System.out.println("mask="+String.format("%8s", Integer.toBinaryString(mask)).replace(' ', '0'));
		//!!!!! when mask is larger than 127, there is problem with result, bigger than 8 bits!
		
		byte fmask = (byte)(mask);
		System.out.println("fmask="+String.format("%8s", Integer.toBinaryString(fmask & 0xff)).replace(' ', '0'));
		
		if(value == true){ //convert from startBit to endBit to 1;
			return (byte)(org | (fmask & 0xff));
		}else {
			return (byte)(org & ~ mask);
		}
	}