Here you can find the source of writeInt(OutputStream os, int value)
public static void writeInt(OutputStream os, int value)
//package com.java2s; import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeInt(OutputStream os, int value) { byte[] buffer = new byte[4]; buffer[0] = (byte) (value >> 24); buffer[1] = (byte) (value >> 16); buffer[2] = (byte) (value >> 8); buffer[3] = (byte) value; try {// ww w . j av a 2 s . c om os.write(buffer); } catch (IOException e) { e.printStackTrace(); } } }