Here you can find the source of intToByteArr(int v)
public static byte[] intToByteArr(int v)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] intToByteArr(int v) { return new byte[] { (byte) (v >>> 24), (byte) (v >>> 16), (byte) (v >>> 8), (byte) (v) }; }//from w ww.j a v a2 s . c o m public static byte[] intToByteArr(int v, byte[] arr, int position) { for (int i = 24; i >= 0; i -= 8) { arr[position--] = (byte) (v >>> i); } return arr; } }