Here you can find the source of writeInt(OutputStream out, int i)
public static void writeInt(OutputStream out, int i) throws IOException
//package com.java2s; import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeInt(OutputStream out, int i) throws IOException { out.write(intToByteArray(i));//from w w w .jav a2 s.c om } public static byte[] intToByteArray(int x) { byte[] b = new byte[4]; b[0] = (byte) (x >>> 24); b[1] = (byte) (x >>> 16); b[2] = (byte) (x >>> 8); b[3] = (byte) (x); return b; } }