NSString * dechex(int value)
{
const NSString* chars = @"0123456789ABCDEF";
size_t base = chars.length;
NSString* result = @"";
while (value >= base) {
result = [NSString stringWithFormat:@"%@%@",[chars substringWithRange:NSMakeRange(value % base,1)], result];
value = value / base;
}
result = [NSString stringWithFormat:@"%@%@",[chars substringWithRange:NSMakeRange(value,1)], result];
NSLog(@"%@", result);
return result;
}