Java tutorial
//package com.java2s; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static void writeWord(FileOutputStream stream, int value) throws IOException { byte[] b = new byte[2]; b[0] = (byte) (value & 0xff); b[1] = (byte) (value >> 8 & 0xff); stream.write(b); } }