code_junkie

Are Integers in Java little endian or big endian?

Nov 12th, 2011
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.15 KB | None | 0 0
  1. int i = (int) b & 0xFF;
  2.  
  3. long l = (long)b[0] & 0xFF;
  4. l += ((long)b[1] & 0xFF;) << 8;
  5. l += ((long)b[2] & 0xFF;) << 16;
  6. l += ((long)b[3] & 0xFF;) << 24;
Add Comment
Please, Sign In to add comment