implemented bitsToConvert
implemented swap