Skip to content

Instantly share code, notes, and snippets.

@odeheurles
Created December 14, 2013 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odeheurles/7958273 to your computer and use it in GitHub Desktop.
Save odeheurles/7958273 to your computer and use it in GitHub Desktop.
public int getInt(final int index, final ByteOrder byteOrder)
{
int bits = UNSAFE.getInt(byteArray, baseOffset + index);
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Integer.reverseBytes(bits);
}
return bits;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment