NSNumber *idValue =[NSNumber numberWithLong:[result longLongValue]];
Above result value is "2174767089" , idValue is "-2120200207" .It got converted.
By mistake I sent this NSNumber to my Server.
Accepting Param in Server (Java Servlet) is Long. In Java Service, I am getting "-2120200207" . Wanted to convert this back to "2174767089" . How is it possible?
我认为您可以使用BigInteger类型,但是您需要使用大整数等值类型(如果您正在使用数据库)来更改数据库。
You appear to want to construct an NSNumber
with a longLongValue
, but the constructor you're calling is for a longValue
.
NSNumber *idValue =[NSNumber numberWithLongLong:[result longLongValue]];
if ([idValue longLongValue] == [result longLongValue]) {
NSLog(@"Of course it does.");
}
Incidentally, a Java Long
is the same length as an Objective-C long long
: 64 bits. An Objective-C long
is a pseudonym for int
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.