Here you can find the source of writeShort(int i, DataOutput out)
private static void writeShort(int i, DataOutput out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { private static void writeShort(int i, DataOutput out) throws IOException { ByteBuffer bb = ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN); bb.putShort((short) i); out.write(bb.array());/*www .ja va 2 s . c o m*/ } }