simplified implementation of int2bin algorithm