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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -