Java ByteBuffer to Int Array getInt(ByteBuffer intCalculator, byte[] bytes)

Here you can find the source of getInt(ByteBuffer intCalculator, byte[] bytes)

Description

Calculates the corresponding integer given 4 sequential bytes.

License

LGPL

Parameter

Parameter Description
intCalculator Buffer to do the conversion
bytes The bytes

Return

Integer value of the bytes

Declaration

public static int getInt(ByteBuffer intCalculator, byte[] bytes) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    /**//from ww w . jav a  2 s  . c  o  m
     * Calculates the corresponding integer given 4 sequential bytes.
     * @param intCalculator Buffer to do the conversion
     * @param bytes The bytes
     * @return Integer value of the bytes
     */
    public static int getInt(ByteBuffer intCalculator, byte[] bytes) {
        intCalculator.clear();
        intCalculator.put(bytes);
        intCalculator.position(0);
        return intCalculator.getInt();
    }
}

Related

  1. getInt(ByteBuffer b, int n)
  2. getInt(ByteBuffer bb)
  3. getInt(ByteBuffer bb, int bi)
  4. getInt(ByteBuffer buffer, ByteOrder order)
  5. getInt(ByteBuffer byteBuffer)
  6. getInt8(ByteBuffer input)
  7. getIntArray(ByteBuffer buffer, int size)
  8. getIntArray(ByteBuffer data, int offset, int length)
  9. getIntBE(ByteBuffer b, int start, int end)