public static byte[] booleanArray2ByteArray(boolean[] input) {
		byte[] result = new byte[input.length / 8];
		
		for(int i = 0;i < input.length;i += 8) {
			//result[i / 8] = 0;
		    for(int j = 0; j < 8; j++) {
		    	if(input[i+j])
		    		result[i / 8] |= (1 << Math.abs(j-7));
		    	else
		    		result[i / 8] &= ~(1 << Math.abs(j-7));
		    }
		}
		return result;
	}