Here you can find the source of intToByteArray(int integer)
public static byte[] intToByteArray(int integer)
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static byte[] intToByteArray(int integer) { ByteBuffer buf = ByteBuffer.allocate(4); buf.putInt(integer);/*www.j a v a2 s.c o m*/ return buf.array(); } }