十进制转二进制快速算法
/// oc十进制转二进制 - (NSString *)decimalismToBinary:(NSInteger)num { NSString *result = @''; NSInteger temp = num; while (temp / 2 >= 0 && temp != 0) { NSString *part = [NSString stringWithFormat:@'%ld', temp % 2]; result = [NSString stringWithFormat:@'%@%@', part, result]; temp = temp / 2; } return result; }
赞30
踩0