Here you can find the source of extractShort(ByteBuffer buffer, boolean bigEndian)
Parameter | Description |
---|---|
buffer | a parameter |
private static byte[] extractShort(ByteBuffer buffer, boolean bigEndian)
//package com.java2s; //License from project: Creative Commons License import java.nio.ByteBuffer; public class Main { /**/*from ww w . ja v a 2 s . co m*/ * @param buffer * @return */ private static byte[] extractShort(ByteBuffer buffer, boolean bigEndian) { byte b1, b2; byte[] result = new byte[2]; b1 = buffer.get(); b2 = buffer.get(); if (bigEndian) { result[0] = b1; result[1] = b2; } else { result[0] = b2; result[1] = b1; } return result; } }