Java ByteBuffer to Int toInt(ByteBuffer bytes)

Here you can find the source of toInt(ByteBuffer bytes)

Description

Convert a byte buffer to an integer.

License

Apache License

Parameter

Parameter Description
bytes byte buffer to convert to integer

Return

int representation of the byte buffer

Declaration

public static int toInt(ByteBuffer bytes) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    /**/*  w  ww .  j  a  va  2s.  c o  m*/
    * Convert a byte buffer to an integer.
    * Does not change the byte buffer position.
    *
    * @param bytes byte buffer to convert to integer
    * @return int representation of the byte buffer
    */
    public static int toInt(ByteBuffer bytes) {
        return bytes.getInt(bytes.position());
    }
}

Related

  1. readVarInt(ByteBuffer buffer)
  2. readVarInt(ByteBuffer stream)
  3. readVarIntRest(ByteBuffer buff, int b)
  4. toInt(ByteBuffer buffer)
  5. toInt(ByteBuffer buffer)
  6. toInt(ByteBuffer value)
  7. toInt16BE(ByteBuffer buf, int[] out)