// Note, we're poping these bits off the top so our string will be in the right order. string GetBinaryString(integer val) { string retVal = ""; integer counter = 0xffffffff; while(counter) { if (val & 0x80000000) { retVal += "1"; } else { retVal += "0"; } val = val << 1; counter = counter << 1; } return retVal; }