How to convert an integer type to an unsigned type?I'm coding in Java -
for example:
public static void main(string[] args) { string str = "11111111111111111111111111111111"; int = integer.parseunsignedint(str, 2); system.out.println(a); }`
result:-1 doesn't range of unsigned int type 0~2^32 - 1?
try this, pass in int function
public static long getunsignedint(int x) { return x & 0x00000000ffffffffl; }
Comments
Post a Comment