Here you can find the source of extractInt(ByteBuffer header_buf, boolean bigEndian)
Parameter | Description |
---|---|
header_buf | a parameter |
bigEndian | a parameter |
public static byte[] extractInt(ByteBuffer header_buf, boolean bigEndian)
//package com.java2s; //License from project: Creative Commons License import java.nio.ByteBuffer; public class Main { /**// www . j av a 2 s . c o m * * @param header_buf * @param bigEndian * @return */ public static byte[] extractInt(ByteBuffer header_buf, boolean bigEndian) { byte b1, b2, b3, b4; b1 = header_buf.get(); b2 = header_buf.get(); b3 = header_buf.get(); b4 = header_buf.get(); byte[] result = new byte[4]; if (bigEndian) { result[0] = b1; result[1] = b2; result[2] = b3; result[3] = b4; } else { result[0] = b4; result[1] = b3; result[2] = b2; result[3] = b1; } return result; } }