Here you can find the source of intToByteArray(int a)
public static byte[] intToByteArray(int a)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] intToByteArray(int a) { return new byte[] { (byte) ((a >> 24) & 0xFF), (byte) ((a >> 16) & 0xFF), (byte) ((a >> 8) & 0xFF), (byte) (a & 0xFF) }; }//from www .j a v a 2 s. c om public static void intToByteArray(int a, byte[] dest, int offset) { dest[offset] = (byte) ((a >> 24) & 0xFF); dest[offset + 1] = (byte) ((a >> 16) & 0xFF); dest[offset + 2] = (byte) ((a >> 8) & 0xFF); dest[offset + 3] = (byte) (a & 0xFF); } }