Java tutorial
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static int getUnsignedShort(ByteBuffer bb) { return (bb.getShort() & 0xffff); } public static int getUnsignedShort(ByteBuffer bb, int position) { return (bb.getShort(position) & 0xffff); } }