Here you can find the source of intToByteArray(int bytes)
public static byte[] intToByteArray(int bytes)
//package com.java2s; public class Main { /** Turn integer into 4 byte array representation */ public static byte[] intToByteArray(int bytes) { return new byte[] { (byte) ((bytes >>> 24) & 0xff), (byte) ((bytes >>> 16) & 0xff), (byte) ((bytes >>> 8) & 0xff), (byte) ((bytes) & 0xff) }; }/*from ww w . j a v a 2 s.c o m*/ }