Java ByteBuffer to Int readInt(ByteBuffer buffer)

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

Description

read Int

License

LGPL

Declaration

public static int readInt(ByteBuffer buffer) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;

public class Main {
    public static int readInt(ByteBuffer buffer) {

        int i = buffer.get() & 0xff;
        i |= (buffer.get() & 0xff) << 8;
        i |= (buffer.get() & 0xff) << 16;
        i |= (buffer.get() & 0xff) << 24;
        return i;
    }/*from  w  w  w. j  av a2  s.  c o  m*/
}

Related

  1. getUShort(java.nio.ByteBuffer buffer)
  2. readInt(ByteBuffer buf)
  3. readInt(ByteBuffer buf, int length)
  4. readInt(ByteBuffer buf, int pos)
  5. readInt(ByteBuffer buffer)
  6. readInt(ReadableByteChannel channel, ByteBuffer buffer)
  7. readInt16(ByteBuffer bb)
  8. readInt32(ByteBuffer bb)
  9. readInt8(final ByteBuffer buffer)