Java tutorial
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static short getUnsignedByte(ByteBuffer bb) { return ((short) (bb.get() & 0xff)); } public static short getUnsignedByte(ByteBuffer bb, int position) { return ((short) (bb.get(position) & (short) 0xff)); } }