Example usage for java.nio ByteBuffer wrap

List of usage examples for java.nio ByteBuffer wrap

Introduction

In this page you can find the example usage for java.nio ByteBuffer wrap.

Prototype

public static ByteBuffer wrap(byte[] array) 

Source Link

Document

Creates a new byte buffer by wrapping the given byte array.

Usage

From source file:Main.java

public static int getIntDate(byte[] bytes) {
    return ByteBuffer.wrap(bytes).getInt();
}

From source file:Main.java

public static float byteToFloat(byte[] array) {
    return ByteBuffer.wrap(array).getFloat();
}

From source file:Main.java

public static String getIntString(byte[] bytes) {
    return "" + ByteBuffer.wrap(bytes).getInt();
}

From source file:Main.java

public static final int fromByteArray(byte[] bytes) {
    return ByteBuffer.wrap(bytes).getInt();
}

From source file:Main.java

public static int getIntFromByteArray(final byte[] bytes) {
    return ByteBuffer.wrap(bytes).getInt();
}

From source file:Main.java

public static long getLongFromByteArray(final byte[] bytes) {
    return ByteBuffer.wrap(bytes).getLong();
}

From source file:Main.java

public static ByteBuffer bytesToBuffer(byte[] bytes) {
    ByteBuffer buff = ByteBuffer.wrap(bytes);
    return buff;
}

From source file:Main.java

public static int byteArrayToInt(byte[] bytes) {
    final ByteBuffer bb = ByteBuffer.wrap(bytes);
    //bb.order(ByteOrder.LITTLE_ENDIAN);
    return bb.getInt();
}

From source file:Main.java

public static UUID toUUID(byte[] bytes) {
    ByteBuffer bb = ByteBuffer.wrap(bytes);
    long firstLong = bb.getLong();
    long secondLong = bb.getLong();
    return new UUID(firstLong, secondLong);
}

From source file:Main.java

public static int my_bb_to_int_le(byte[] byteBarray) {
    return ByteBuffer.wrap(byteBarray).order(ByteOrder.LITTLE_ENDIAN).getInt();
}