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; //License from project: Open Source License import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; public class Main { public static void writeInt(OutputStream out, int i) throws IOException { byte[] bytes = new byte[Integer.BYTES]; ByteBuffer.wrap(bytes).putInt(i); out.write(bytes);/*from w w w.j av a 2 s .c om*/ } public static byte[] writeInt(int i) { byte[] bytes = new byte[Integer.BYTES]; ByteBuffer.wrap(bytes).putInt(i); return bytes; } }