Java ByteBuffer to Long getUInt(ByteBuffer buffer)

Here you can find the source of getUInt(ByteBuffer buffer)

Description

get U Int

License

Open Source License

Declaration

public static long getUInt(ByteBuffer buffer) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static long getUInt(ByteBuffer buffer) {

        assert (buffer.capacity() - buffer.position() >= 4);

        byte[] data = new byte[4];

        data[3] = buffer.get();/*from w w  w .ja v  a2  s  . c  o m*/
        data[2] = buffer.get();
        data[1] = buffer.get();
        data[0] = buffer.get();

        return ((data[0] << 24) & 0xff000000l) | ((data[1] << 16) & 0x00ff0000l) | ((data[2] << 8) & 0x0000ff00l)
                | (data[3] & 0x000000ffl);
    }
}

Related

  1. getUInt(ByteBuffer buffer)
  2. getUInt(java.nio.ByteBuffer buffer)
  3. getUInt16(ByteBuffer b, int n)
  4. getUInt16(ByteBuffer buffer)