@Test public void testUnsignedIntDecode() { byte[] b = new byte[8]; long l = 0xFE010203L; ByteBuffer.wrap(b).putLong(l); long l1 = Integer.toUnsignedLong(ByteArrayUtils.decodeInt(b, 4)); assertEquals(l, l1); }
public static int decodeInt(byte[] a, int offset) { return ((a[offset] & 0xFF) << 24) + ((a[offset + 1] & 0xFF) << 16) + ((a[offset + 2] & 0xFF) << 8) + ((a[offset + 3] & 0xFF)); }
ByteArrayUtils { public static int decodeInt(byte[] a, int offset) { return ((a[offset] & 0xFF) << 24) + ((a[offset + 1] & 0xFF) << 16) + ((a[offset + 2] & 0xFF) << 8) + ((a[offset + 3] & 0xFF)); } }
ByteArrayUtils { public static int decodeInt(byte[] a, int offset) { return ((a[offset] & 0xFF) << 24) + ((a[offset + 1] & 0xFF) << 16) + ((a[offset + 2] & 0xFF) << 8) + ((a[offset + 3] & 0xFF)); }  }
ByteArrayUtils { public static int decodeInt(byte[] a, int offset) { return ((a[offset] & 0xFF) << 24) + ((a[offset + 1] & 0xFF) << 16) + ((a[offset + 2] & 0xFF) << 8) + ((a[offset + 3] & 0xFF)); }  static boolean startsWith(byte[] a, byte[] b); static boolean equalsPrefix(byte[] a, byte b[], int n); static byte[] plusOne(byte[] a); static int compare(byte[] a1, byte[] a2); static byte[] encodeInt(int x, byte[] a, int offset); static byte[] encodeLong(long x, byte[] a, int offset); static byte[] encodeLongLE(long x, byte[] a, int offset); static byte[] encodeLong(long x); static long decodeLong(byte[] a, int offset); static long decodeLongLE(byte[] a, int offset); static byte[] encode6Bytes(long x, byte[] a, int offset); static long decode6Bytes(byte[] a, int offset); static byte[] encode5Bytes(long x, byte[] a, int offset); static long decode5Bytes(byte[] a, int offset); static int decodeInt(byte[] a, int offset); static int decodeIntLE(byte[] a, int offset); static byte[] encode3Bytes(int x, byte[] a, int offset); static int decode3Bytes(byte[] a, int offset); static byte[] encodeShort(int x, byte[] a, int offset); static int decodeShort(byte[] a, int offset); static int decodeShortLE(byte[] a, int offset); }
ByteArrayUtils { public static int decodeInt(byte[] a, int offset) { return ((a[offset] & 0xFF) << 24) + ((a[offset + 1] & 0xFF) << 16) + ((a[offset + 2] & 0xFF) << 8) + ((a[offset + 3] & 0xFF)); }  static boolean startsWith(byte[] a, byte[] b); static boolean equalsPrefix(byte[] a, byte b[], int n); static byte[] plusOne(byte[] a); static int compare(byte[] a1, byte[] a2); static byte[] encodeInt(int x, byte[] a, int offset); static byte[] encodeLong(long x, byte[] a, int offset); static byte[] encodeLongLE(long x, byte[] a, int offset); static byte[] encodeLong(long x); static long decodeLong(byte[] a, int offset); static long decodeLongLE(byte[] a, int offset); static byte[] encode6Bytes(long x, byte[] a, int offset); static long decode6Bytes(byte[] a, int offset); static byte[] encode5Bytes(long x, byte[] a, int offset); static long decode5Bytes(byte[] a, int offset); static int decodeInt(byte[] a, int offset); static int decodeIntLE(byte[] a, int offset); static byte[] encode3Bytes(int x, byte[] a, int offset); static int decode3Bytes(byte[] a, int offset); static byte[] encodeShort(int x, byte[] a, int offset); static int decodeShort(byte[] a, int offset); static int decodeShortLE(byte[] a, int offset); static final byte[] EMPTY; }