Here you can find the source of intToBytes(int val, byte[] bytes, int start)
public static void intToBytes(int val, byte[] bytes, int start)
//package com.java2s; //License from project: LGPL public class Main { public static void intToBytes(int val, byte[] bytes, int start) { bytes[start + 0] = (byte) val; bytes[start + 1] = (byte) (0xff & (val >> 8)); bytes[start + 2] = (byte) (0xff & (val >> 16)); bytes[start + 3] = (byte) (0xff & (val >> 24)); }//from w w w. jav a 2s . co m }