Here you can find the source of writeUB2(ByteBuffer buffer, int i)
public static final void writeUB2(ByteBuffer buffer, int i)
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static final void writeUB2(ByteBuffer buffer, int i) { buffer.put((byte) (i & 0xff)); buffer.put((byte) (i >>> 8)); }// ww w. j a v a 2 s . c om }