result := '';
counter := $80000000;
{Suppress leading zeros}
while ((counter and TheVal) = 0) do begin
counter := counter shr 1;
if (counter = 0) then break; {We found our first
"1".}
end;
while counter > 0 do begin
if (counter and TheVal) = 0 then result := result
+ '0'
else result := result + '1';
counter := counter shr 1;
end;
end;