title: What is the equivalent of unsigned long in java
body: <p>i have written these following three functions for my project to work: </p>
  
  <pre><code> WORD shuffling(WORD x)
  {
  
  // WORD - 4 bytes - 32 bits
  
  //given input - a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15- b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15
  
  //output required - a0,b0,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7 - a8,b8,a9,b9,a10,b10,a11,b11,a12,b12,a13,b13,a14,b14,a15,b15
  
      x = (x &amp; 0X0000FF00) &lt;&lt; 8 | (x &gt;&gt; 8) &amp; 0X0000FF00 | x &amp; 0XFF0000FF;
      x = (x &amp; 0X00F000F0) &lt;&lt; 4 | (x &gt;&gt; 4) &amp; 0X00F000F0 | x &amp; 0XF00FF00F;
      x = (x &amp; 0X0C0C0C0C) &lt;&lt; 2 | (x &gt;&gt; 2) &amp; 0X0C0C0C0C | x &amp; 0XC3C3C3C3;
      x = (x &amp; 0X22222222) &lt;&lt; 1 | (x &gt;&gt; 1) &amp; 0X22222222 | x &amp; 0X99999999;
      return x;
  }
  
  WORD t_function(WORD n)
  {
  
      WORD t_result=0;
      WORD64 var = 2*((n*n)&amp; 0xFFFFFFFF)+n;   // (n*n mod FFFFFFFF) becomes a 32-bit word
      t_result = (WORD) ((var)&amp; 0xFFFFFFFF);
      return t_result;
  }
  
  WORD lfsr(WORD t_result)
  {
  
      WORD returnValue = t_result;
      WORD flag = 0;
      flag = returnValue &amp; 0x80000000; // Checking if MSB is 1 or 0
  
      // Left shift the input
      returnValue = returnValue &lt;&lt; 1;
  
      // If MSB is 1 then XOR the reult with the primitive polynomial
      if(flag &gt; 0)
      {
          returnValue = returnValue ^ 0x4C11DB7;
      }
      return returnValue;
  }
  </code></pre>
  
  <p>WORD - unsigned long</p>
  
  <p>this code is in "c". Now i have to implement this in java. Everything is fine in compiling and running the code. But here i used unsigned long and in java i have used int Since i am operating on 32bits at a time. The problem is "when implementing in java whenever the result is going out of range of int the output is being deviated and it will not be the same output from the c code. Is there any solution for my problem to replace the unsigned long range values in java</p>