Here you can find the source of toShort(ByteBuffer value)
public static short toShort(ByteBuffer value)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static short toShort(ByteBuffer value) { short result = 0; try {// w ww .ja va2 s .c om if (value != null) { int originPos = value.position(); result = value.getShort(); value.position(originPos); } } catch (Exception ex) { // ex.printStackTrace(); } return result; } }