Here you can find the source of intToBytes(byte[] bytes, int index, int value)
public static void intToBytes(byte[] bytes, int index, int value)
//package com.java2s; //License from project: Open Source License public class Main { public static void intToBytes(byte[] bytes, int index, int value) { for (int j = 3; j >= 0; j--) { bytes[index + j] = (byte) (value & 0xff); value >>>= 8;/*from w w w . j av a 2 s .c om*/ } } }